theodotus commited on
Commit
cd85390
·
1 Parent(s): 07a7baf

Added Test class

Browse files
Files changed (1) hide show
  1. utils.py +25 -0
utils.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+
4
+
5
+ class Test:
6
+ def __init__(self):
7
+ self.data = self.read_test_data()
8
+
9
+ def __len__(self):
10
+ return len(self.data)
11
+
12
+ @staticmethod
13
+ def read_test_data():
14
+ with open("test.json") as f:
15
+ test_data = json.load(f)
16
+ return test_data
17
+
18
+ def get_question(self, idx):
19
+ question = self.data[idx]["question"]
20
+ return question
21
+
22
+ def get_answers(self, idx):
23
+ responces = self.data[idx]["responces"]
24
+ answers = [responce["answer"] for responce in responces]
25
+ return answers