summaryrefslogtreecommitdiff
path: root/yaksh/python_stdout_evaluator.py
diff options
context:
space:
mode:
authorankitjavalkar2016-03-22 16:11:28 +0530
committerankitjavalkar2016-05-05 19:00:33 +0530
commit1f4542cdbea66899899b9c7de3ea38e39d794112 (patch)
tree62aa4a8b780888f99464e552ba18557a98bf6ca7 /yaksh/python_stdout_evaluator.py
parent597c23866be3ecfdf94c40693b060fe9ebbf6446 (diff)
downloadonline_test-1f4542cdbea66899899b9c7de3ea38e39d794112.tar.gz
online_test-1f4542cdbea66899899b9c7de3ea38e39d794112.tar.bz2
online_test-1f4542cdbea66899899b9c7de3ea38e39d794112.zip
Add anti-cheating for python stdout evaluator and modify test
Diffstat (limited to 'yaksh/python_stdout_evaluator.py')
-rw-r--r--yaksh/python_stdout_evaluator.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/yaksh/python_stdout_evaluator.py b/yaksh/python_stdout_evaluator.py
index 8f3eb65..815752f 100644
--- a/yaksh/python_stdout_evaluator.py
+++ b/yaksh/python_stdout_evaluator.py
@@ -35,8 +35,12 @@ class PythonStdoutEvaluator(CodeEvaluator):
g = {}
exec submitted in g
raw_output_value = output_buffer.getvalue()
- output_value = raw_output_value.encode('string_escape').strip()
- if output_value == expected_output:
+ # output_value = raw_output_value.encode('string_escape').strip()
+ output_value = raw_output_value.strip()
+ if expected_output in user_answer:
+ success = False
+ err = "Incorrect Answer: Please avoid printing the expected output directly"
+ elif output_value == expected_output:
success = True
err = "Correct answer"
@@ -46,3 +50,4 @@ class PythonStdoutEvaluator(CodeEvaluator):
del tb
return success, err
+