diff options
author | maheshgudi | 2017-10-25 13:16:16 +0530 |
---|---|---|
committer | maheshgudi | 2017-10-25 13:16:16 +0530 |
commit | eaf1735f748279f3c9c313375c51f2f886292934 (patch) | |
tree | 57bbcb78ac88ddedd2f3544e115680fe0ab0a028 /yaksh/stdio_evaluator.py | |
parent | 52c0408298a5559cb24f7e2f4251b207546c7d22 (diff) | |
parent | e45b9cce359567c28001b34e1ccd14b51130cdb3 (diff) | |
download | online_test-eaf1735f748279f3c9c313375c51f2f886292934.tar.gz online_test-eaf1735f748279f3c9c313375c51f2f886292934.tar.bz2 online_test-eaf1735f748279f3c9c313375c51f2f886292934.zip |
Merge branch '0.7_bugfix' of https://github.com/maheshgudi/online_test into 0.7_bugfix
Diffstat (limited to 'yaksh/stdio_evaluator.py')
-rw-r--r-- | yaksh/stdio_evaluator.py | 11 |
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: |