summaryrefslogtreecommitdiff
path: root/yaksh/stdio_evaluator.py
diff options
context:
space:
mode:
authorprathamesh2017-10-26 14:46:14 +0530
committerprathamesh2017-10-26 14:46:14 +0530
commit8dc6f2c9271e2e2aef9c30594df85af8b24aeeb4 (patch)
treed3c9d2ef6afbfb5307fb2b4b9e867253da98eacf /yaksh/stdio_evaluator.py
parent1f554e7505f5a6aa1b796b2e31e1541188af56da (diff)
parent840c00b9e939d2b33058d236ef4170923e0a018b (diff)
downloadonline_test-8dc6f2c9271e2e2aef9c30594df85af8b24aeeb4.tar.gz
online_test-8dc6f2c9271e2e2aef9c30594df85af8b24aeeb4.tar.bz2
online_test-8dc6f2c9271e2e2aef9c30594df85af8b24aeeb4.zip
Merge branch 'master' of https://github.com/FOSSEE/online_test into detailed_csv_download_quiz
RESOLVED Conflicts: yaksh/test_models.py
Diffstat (limited to 'yaksh/stdio_evaluator.py')
-rw-r--r--yaksh/stdio_evaluator.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/yaksh/stdio_evaluator.py b/yaksh/stdio_evaluator.py
index 932ae7e..5e4ce18 100644
--- a/yaksh/stdio_evaluator.py
+++ b/yaksh/stdio_evaluator.py
@@ -11,10 +11,15 @@ from .compare_stdio import compare_outputs
class StdIOEvaluator(BaseEvaluator):
def evaluate_stdio(self, user_answer, proc, expected_input, expected_output):
success = False
- ip = expected_input.replace(",", " ")
- encoded_input = '{0}\n'.format(ip).encode('utf-8')
try:
- user_output_bytes, output_err_bytes = proc.communicate(encoded_input)
+ if expected_input:
+ ip = expected_input.replace(",", " ")
+ encoded_input = '{0}\n'.format(ip).encode('utf-8')
+ user_output_bytes, output_err_bytes = proc.communicate(
+ encoded_input
+ )
+ else:
+ user_output_bytes, output_err_bytes = proc.communicate()
user_output = user_output_bytes.decode('utf-8')
output_err = output_err_bytes.decode('utf-8')
except TimeoutException: