diff options
author | ankitjavalkar | 2016-04-06 11:26:52 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-05-05 19:16:26 +0530 |
commit | d3241512c71d61b355358a691d18e4ff8a8df34c (patch) | |
tree | 0d1810fab8a10b7671400dab64a8b877b334a676 /yaksh/models.py | |
parent | f120f5763904589d3c18b6cc0f4e227bcaef9a0a (diff) | |
download | online_test-d3241512c71d61b355358a691d18e4ff8a8df34c.tar.gz online_test-d3241512c71d61b355358a691d18e4ff8a8df34c.tar.bz2 online_test-d3241512c71d61b355358a691d18e4ff8a8df34c.zip |
Multiple test cases passed as dicts, check_code() is iterated based on no. of test cases
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 331446f..fd60036 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -228,8 +228,8 @@ class Question(models.Model): test_cases = self.testcase_set.all() for test in test_cases: - test_instance = test.get_child_instance(self.test_case_type) - test_case_field_value = test_instance.get_field_value() + test_case_child_instance = test.get_child_instance(self.test_case_type) + test_case_instance_dict = test_case_child_instance.get_instance_as_dict() test_case_data.append(test_case_field_value) question_data['test_case_data'] = test_case_data @@ -779,17 +779,18 @@ class StandardTestCase(TestCase): test_case = models.TextField(blank=True) def get_field_value(self): - return self.test_case + return {"test_case": self.test_case} + class StdoutBasedTestCase(TestCase): - output = models.TextField(blank=True) + expected_output = models.TextField(blank=True) def get_field_value(self): - return self.output + return {"expected_output": self.expected_output} class McqTestCase(TestCase): options = models.TextField() correct = models.BooleanField(default=False) - def validate(self, user_answer): - pass + def get_field_value(self): + return {"options": self.options, "correct": self.correct} |