From dc2d4c0654d6d7c23ccf7b10aa985cc6afe4f4a7 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Mon, 9 Oct 2017 17:32:11 +0530 Subject: Fix expected input as None bug --- yaksh/stdio_evaluator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'yaksh/stdio_evaluator.py') 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: -- cgit