diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-12 14:47:33 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-12 14:47:33 +0100 |
commit | 05e778a6d06f9d74ebc73fb5113643ffd80a6a8b (patch) | |
tree | 61865d508a5cb95e8a750057d11c61159451b861 /prolog/problems/family_relations | |
parent | 75a6d1e8b3f48cb6beb3a5b417d84c83615acd68 (diff) |
Prolog: catch exceptions in test functions
Diffstat (limited to 'prolog/problems/family_relations')
10 files changed, 20 insertions, 0 deletions
diff --git a/prolog/problems/family_relations/ancestor_2/common.py b/prolog/problems/family_relations/ancestor_2/common.py index 1ad1d4f..a946636 100644 --- a/prolog/problems/family_relations/ancestor_2/common.py +++ b/prolog/problems/family_relations/ancestor_2/common.py @@ -50,6 +50,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/aunt_2/common.py b/prolog/problems/family_relations/aunt_2/common.py index 6ad8b05..e92ddfa 100644 --- a/prolog/problems/family_relations/aunt_2/common.py +++ b/prolog/problems/family_relations/aunt_2/common.py @@ -54,6 +54,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py index c8ceb75..73084d2 100644 --- a/prolog/problems/family_relations/brother_2/common.py +++ b/prolog/problems/family_relations/brother_2/common.py @@ -48,6 +48,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/connected_3/common.py b/prolog/problems/family_relations/connected_3/common.py index eee1df5..5b1a3aa 100644 --- a/prolog/problems/family_relations/connected_3/common.py +++ b/prolog/problems/family_relations/connected_3/common.py @@ -39,6 +39,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/cousin_2/common.py b/prolog/problems/family_relations/cousin_2/common.py index e53ef99..d87fb85 100644 --- a/prolog/problems/family_relations/cousin_2/common.py +++ b/prolog/problems/family_relations/cousin_2/common.py @@ -61,6 +61,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/descendant_2/common.py b/prolog/problems/family_relations/descendant_2/common.py index eae7c42..bd8e96a 100644 --- a/prolog/problems/family_relations/descendant_2/common.py +++ b/prolog/problems/family_relations/descendant_2/common.py @@ -50,6 +50,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py index 363eaa2..13333d1 100644 --- a/prolog/problems/family_relations/father_2/common.py +++ b/prolog/problems/family_relations/father_2/common.py @@ -51,6 +51,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index 3d187d9..2313387 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -52,6 +52,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/mother_2/common.py b/prolog/problems/family_relations/mother_2/common.py index cb8ddee..456f51f 100644 --- a/prolog/problems/family_relations/mother_2/common.py +++ b/prolog/problems/family_relations/mother_2/common.py @@ -52,6 +52,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index 0466a3d..1d8eaeb 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -49,6 +49,8 @@ def test(code, aux_code): for query, answers in test_cases: if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0): n_correct += 1 + except: + pass finally: if engine_id: prolog.engine.destroy(engine_id) |