From c7cdf2554a1a55f27685c1d6fececb76a746e536 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Wed, 21 Dec 2016 13:25:55 +0530 Subject: Fix test cases for storing error as list --- yaksh/python_assertion_evaluator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/python_assertion_evaluator.py') diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 4d44838..41ebeb6 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -75,7 +75,7 @@ class PythonAssertionEvaluator(BaseEvaluator): type, value, tb = sys.exc_info() info = traceback.extract_tb(tb) fname, lineno, func, text = info[-1] - text = str(self.test_case).splitlines()[lineno-1] + text = str(self.test_case) err = ("-----\nExpected Test Case:\n{0}\n" "Error - {1} {2} in: {3}\n-----").format(self.test_case, type.__name__, str(value), text) except TimeoutException: -- cgit From a88197040b69a556f9c7b0432350b9d1d4aad06f Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Wed, 21 Dec 2016 18:09:49 +0530 Subject: Fix rendering and representation of errors - Error are sent as list - Error are None if answer is fully correct - Error is rendered as in grade user and code questions as neat CSS divs - Fix corresponding test cases - Fix get_question answers in models.py --- yaksh/python_assertion_evaluator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'yaksh/python_assertion_evaluator.py') diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 41ebeb6..d8cd07c 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -76,8 +76,13 @@ class PythonAssertionEvaluator(BaseEvaluator): info = traceback.extract_tb(tb) fname, lineno, func, text = info[-1] text = str(self.test_case) - err = ("-----\nExpected Test Case:\n{0}\n" - "Error - {1} {2} in: {3}\n-----").format(self.test_case, type.__name__, str(value), text) + err = "Expected Test Case:\n{0}\n" \ + "Error - {1} {2} in: {3}\n-----".format( + self.test_case, + type.__name__, + str(value), + text + ) except TimeoutException: raise except Exception: @@ -85,7 +90,7 @@ class PythonAssertionEvaluator(BaseEvaluator): err = "Error in Test case: {0}".format(msg) else: success = True - err = '-----\nCorrect answer\nTest Case: {0}\n-----'.format(self.test_case) + err = None mark_fraction = float(self.weight) if self.partial_grading else 0.0 del tb return success, err, mark_fraction -- cgit From 0e56fc6a77ec21db05c9bafb42b1acc652354a32 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 22 Dec 2016 20:16:00 +0530 Subject: - Fix grade user rendering issue when question is skipped - Modify grade user html template to create readable variables for answer and error --- yaksh/python_assertion_evaluator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/python_assertion_evaluator.py') diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index d8cd07c..749a6ec 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -77,7 +77,7 @@ class PythonAssertionEvaluator(BaseEvaluator): fname, lineno, func, text = info[-1] text = str(self.test_case) err = "Expected Test Case:\n{0}\n" \ - "Error - {1} {2} in: {3}\n-----".format( + "Error - {1} {2} in: {3}\n".format( self.test_case, type.__name__, str(value), -- cgit