From 05e778a6d06f9d74ebc73fb5113643ffd80a6a8b Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 12 Feb 2016 14:47:33 +0100 Subject: Prolog: catch exceptions in test functions --- prolog/problems/family_relations/ancestor_2/common.py | 2 ++ prolog/problems/family_relations/aunt_2/common.py | 2 ++ prolog/problems/family_relations/brother_2/common.py | 2 ++ prolog/problems/family_relations/connected_3/common.py | 2 ++ prolog/problems/family_relations/cousin_2/common.py | 2 ++ prolog/problems/family_relations/descendant_2/common.py | 2 ++ prolog/problems/family_relations/father_2/common.py | 2 ++ prolog/problems/family_relations/grandparent_2/common.py | 2 ++ prolog/problems/family_relations/mother_2/common.py | 2 ++ prolog/problems/family_relations/sister_2/common.py | 2 ++ 10 files changed, 20 insertions(+) (limited to 'prolog/problems/family_relations') 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) -- cgit v1.2.1