diff options
Diffstat (limited to 'python/problems/lists_and_for/contains_42/common.py')
-rw-r--r-- | python/problems/lists_and_for/contains_42/common.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/python/problems/lists_and_for/contains_42/common.py b/python/problems/lists_and_for/contains_42/common.py index 3ebe546..915938e 100644 --- a/python/problems/lists_and_for/contains_42/common.py +++ b/python/problems/lists_and_for/contains_42/common.py @@ -48,6 +48,7 @@ def test(python, code): ] n_correct = 0 + tin = None for xs_i, xs in enumerate(test_xs): # change code to contain new xs instead of the one # given by user @@ -63,15 +64,20 @@ def test(python, code): if str(test_out[xs_i]) in output and \ str(not test_out[xs_i]) not in output: n_correct += 1 - - passed = n_correct == len(test_in) - hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_in)}}] + else: + tin = test_xs[xs_i] + tout = test_out[xs_i] + + passed = n_correct == len(test_xs) + hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_xs)}}] + 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 answer = python(code=code, inputs=[(None, None)], timeout=1.0) - exc = get_exception_desc(answer) + exc = get_exception_desc(answer[0][3]) if exc: return exc tokens = get_tokens(code) |