diff options
author | ankitjavalkar | 2016-11-04 18:07:35 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-11-10 12:43:14 +0530 |
commit | 576c92b3b7d8989bf6bb99316d096f48f5b4cc24 (patch) | |
tree | f1f36b8cae1c9ffad9c5cb5637e857ad9b01aba4 /yaksh/python_stdio_evaluator.py | |
parent | 0bfa58d8705fa08b45a208a4cec98dd267799f8a (diff) | |
download | online_test-576c92b3b7d8989bf6bb99316d096f48f5b4cc24.tar.gz online_test-576c92b3b7d8989bf6bb99316d096f48f5b4cc24.tar.bz2 online_test-576c92b3b7d8989bf6bb99316d096f48f5b4cc24.zip |
Fix test cases for partial grading feature
Diffstat (limited to 'yaksh/python_stdio_evaluator.py')
-rw-r--r-- | yaksh/python_stdio_evaluator.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/yaksh/python_stdio_evaluator.py b/yaksh/python_stdio_evaluator.py index cbbbfd6..7df0ba1 100644 --- a/yaksh/python_stdio_evaluator.py +++ b/yaksh/python_stdio_evaluator.py @@ -31,6 +31,10 @@ def redirect_stdout(): class PythonStdioEvaluator(CodeEvaluator): """Tests the Python code obtained from Code Server""" + def setup(self): + super(PythonStdioEvaluator, self).setup() + self.files = [] + def teardown(self): # Delete the created file. if self.files: @@ -38,8 +42,7 @@ class PythonStdioEvaluator(CodeEvaluator): super(PythonStdioEvaluator, self).teardown() - def compile_code(self, user_answer, file_paths, expected_input, expected_output): - self.files = [] + def compile_code(self, user_answer, file_paths, expected_input, expected_output, marks): if file_paths: self.files = copy_files(file_paths) submitted = compile(user_answer, '<string>', mode='exec') @@ -54,13 +57,15 @@ class PythonStdioEvaluator(CodeEvaluator): self.output_value = output_buffer.getvalue().rstrip("\n") return self.output_value - def check_code(self, user_answer, file_paths, expected_input, expected_output): + def check_code(self, user_answer, file_paths, partial_grading, expected_input, expected_output, marks): success = False + test_case_marks = 0.0 tb = None if self.output_value == expected_output: success = True err = "Correct answer" + test_case_marks = marks else: success = False err = dedent(""" @@ -74,4 +79,4 @@ class PythonStdioEvaluator(CodeEvaluator): ) ) del tb - return success, err + return success, err, test_case_marks |