From 70a35ac2a001bd9638d9db5ed645d00f94ae4666 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Mon, 6 Nov 2017 16:34:37 +0530 Subject: Change module compare_stdio to error_messages --- yaksh/python_assertion_evaluator.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'yaksh/python_assertion_evaluator.py') diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index af89fc3..8c24e24 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -11,6 +11,7 @@ import importlib from .file_utils import copy_files, delete_files from .base_evaluator import BaseEvaluator from .grader import TimeoutException +from .error_messages import prettify_exceptions class PythonAssertionEvaluator(BaseEvaluator): @@ -74,26 +75,16 @@ class PythonAssertionEvaluator(BaseEvaluator): exec(_tests, self.exec_scope) except TimeoutException: raise - except AssertionError: - exc_type, exc_value, exc_tb = sys.exc_info() - value = "Expected answer from the test case didnt match the output" - err = {"type": "assertion", - "test_case": self.test_case, - "exception": exc_type.__name__, - "message": value, - } except Exception: exc_type, exc_value, exc_tb = sys.exc_info() tb_list = traceback.format_exception(exc_type, exc_value, exc_tb) if len(tb_list) > 2: del tb_list[1:3] - - err = {"type": "assertion", - "traceback": "".join(tb_list), - "exception": exc_type.__name__, - "message": str(exc_value) - } - + err = prettify_exceptions(exc_type.__name__, + str(exc_value), + "".join(tb_list), + self.test_case + ) else: success = True err = None -- cgit