Spaces:
Sleeping
Sleeping
File size: 567 Bytes
cd85390 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import json
class Test:
def __init__(self):
self.data = self.read_test_data()
def __len__(self):
return len(self.data)
@staticmethod
def read_test_data():
with open("test.json") as f:
test_data = json.load(f)
return test_data
def get_question(self, idx):
question = self.data[idx]["question"]
return question
def get_answers(self, idx):
responces = self.data[idx]["responces"]
answers = [responce["answer"] for responce in responces]
return answers |