diff options
author | Prabhu Ramachandran | 2017-10-17 22:50:36 +0530 |
---|---|---|
committer | GitHub | 2017-10-17 22:50:36 +0530 |
commit | 4e7d09eae252c6d89d2fecfe18ffce46e4421eb0 (patch) | |
tree | 13586b1dfd8003cef645c99e2cb3801835496674 /yaksh/stdio_evaluator.py | |
parent | 2ab25fcf914215e00fcfd6196576444c1a75c808 (diff) | |
parent | 1ad1ef1c69cb8208e4d330a9695442b4d78134ac (diff) | |
download | online_test-4e7d09eae252c6d89d2fecfe18ffce46e4421eb0.tar.gz online_test-4e7d09eae252c6d89d2fecfe18ffce46e4421eb0.tar.bz2 online_test-4e7d09eae252c6d89d2fecfe18ffce46e4421eb0.zip |
Merge pull request #351 from maheshgudi/yaml_fixes
Yaml fixes
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: |