summaryrefslogtreecommitdiff
path: root/yaksh/python_assertion_evaluator.py
diff options
context:
space:
mode:
authorankitjavalkar2016-11-16 20:32:21 +0530
committerankitjavalkar2016-11-16 20:32:21 +0530
commitcb9a541a4653b2ed13db3a6171b50de575b0f05d (patch)
tree9fcab71c37e49ac1dfe61ba35fb97b50a32aaa25 /yaksh/python_assertion_evaluator.py
parent0b151541d9414572965b597815f98c4b057430e1 (diff)
downloadonline_test-cb9a541a4653b2ed13db3a6171b50de575b0f05d.tar.gz
online_test-cb9a541a4653b2ed13db3a6171b50de575b0f05d.tar.bz2
online_test-cb9a541a4653b2ed13db3a6171b50de575b0f05d.zip
Fix Output display of Code Question
Diffstat (limited to 'yaksh/python_assertion_evaluator.py')
-rw-r--r--yaksh/python_assertion_evaluator.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index 1cc4fa4..275244a 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -68,12 +68,13 @@ class PythonAssertionEvaluator(CodeEvaluator):
info = traceback.extract_tb(tb)
fname, lineno, func, text = info[-1]
text = str(test_case).splitlines()[lineno-1]
- err = "{0} {1} in: {2}".format(type.__name__, str(value), text)
+ err = ("-----\nExpected Test Case:\n{0}\n"
+ "Error - {1} {2} in: {3}\n-----").format(test_case, type.__name__, str(value), text)
except Exception:
raise # Exception will be caught in CodeEvaluator.
else:
success = True
- err = 'Correct answer'
+ err = '-----\nCorrect answer\nTest Case: {0}\n-----'.format(test_case)
test_case_weight = float(weight) if partial_grading else 0.0
del tb
return success, err, test_case_weight