summaryrefslogtreecommitdiff
path: root/python/problems/while_and_if/competition
diff options
context:
space:
mode:
Diffstat (limited to 'python/problems/while_and_if/competition')
-rw-r--r--python/problems/while_and_if/competition/common.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/problems/while_and_if/competition/common.py b/python/problems/while_and_if/competition/common.py
index 4be8b12..a7471df 100644
--- a/python/problems/while_and_if/competition/common.py
+++ b/python/problems/while_and_if/competition/common.py
@@ -45,19 +45,25 @@ def test(python, code):
outputs = [ans[1] for ans in answers]
n_correct = 0
- for output, correct in zip(outputs, test_out):
+ tin = None
+ for i, (output, correct) in enumerate(zip(outputs, test_out)):
if string_almost_equal(output, correct):
n_correct += 1
+ else:
+ tin = test_in[i][1]
+ tout = correct
passed = n_correct == len(test_in)
hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_in)}}]
+ if tin:
+ hints.append({'id': 'problematic_test_case', 'args': {'testin': str(tin), 'testout': str(tout)}})
return passed, hints
def hint(python, code):
# run one test first to see if there are any exceptions
test_in = [(None, '5\n1\n1\n1\n1\n1\n')]
answer = python(code=code, inputs=test_in, timeout=1.0)
- exc = get_exception_desc(answer)
+ exc = get_exception_desc(answer[0][3])
if exc: return exc
tokens = get_tokens(code)