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/python_assertion_evaluator.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/python_assertion_evaluator.py')
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 0615d84..15ff8fd 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -13,21 +13,21 @@ class PythonAssertionEvaluator(CodeEvaluator): """Tests the Python code obtained from Code Server""" # def check_code(self, test, user_answer, ref_code_path): - def check_code(self, user_answer, test_case_data): + # def check_code(self, user_answer, test_case_data): #@@@v2 + def check_code(self, user_answer, test_case): success = False try: tb = None submitted = compile(user_answer, '<string>', mode='exec') g = {} exec submitted in g - for test_code in test_case_data: - _tests = compile(test_code, '<string>', mode='exec') - exec _tests in g + _tests = compile(test_case, '<string>', mode='exec') + exec _tests in g except AssertionError: type, value, tb = sys.exc_info() info = traceback.extract_tb(tb) fname, lineno, func, text = info[-1] - text = str(test_code).splitlines()[lineno-1] + text = str(test_case).splitlines()[lineno-1] err = "{0} {1} in: {2}".format(type.__name__, str(value), text) except TimeoutException: raise |