diff options
Diffstat (limited to 'yaksh/python_assertion_evaluator.py')
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 1b66fd2..78154a3 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -1,13 +1,14 @@ #!/usr/bin/env python +from __future__ import absolute_import import sys import traceback import os from os.path import join import importlib -# local imports -from code_evaluator import CodeEvaluator, TimeoutException -from file_utils import copy_files, delete_files +# Local imports +from .code_evaluator import CodeEvaluator, TimeoutException +from .file_utils import copy_files, delete_files class PythonAssertionEvaluator(CodeEvaluator): @@ -32,7 +33,7 @@ class PythonAssertionEvaluator(CodeEvaluator): else: submitted = compile(user_answer, '<string>', mode='exec') self.exec_scope = {} - exec submitted in self.exec_scope + exec(submitted, self.exec_scope) return self.exec_scope def check_code(self, user_answer, file_paths, test_case): @@ -40,7 +41,7 @@ class PythonAssertionEvaluator(CodeEvaluator): try: tb = None _tests = compile(test_case, '<string>', mode='exec') - exec _tests in self.exec_scope + exec(_tests, self.exec_scope) except AssertionError: type, value, tb = sys.exc_info() info = traceback.extract_tb(tb) |