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/sets/diff_3/common.py | 2 ++ prolog/problems/sets/intersect_3/common.py | 2 ++ prolog/problems/sets/is_subset_2/common.py | 2 ++ prolog/problems/sets/is_superset_2/common.py | 2 ++ prolog/problems/sets/powerset_2/common.py | 2 ++ prolog/problems/sets/subset_2/common.py | 2 ++ prolog/problems/sets/union_3/common.py | 2 ++ 7 files changed, 14 insertions(+) (limited to 'prolog/problems/sets') diff --git a/prolog/problems/sets/diff_3/common.py b/prolog/problems/sets/diff_3/common.py index dbb80b4..d9b5362 100644 --- a/prolog/problems/sets/diff_3/common.py +++ b/prolog/problems/sets/diff_3/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/sets/intersect_3/common.py b/prolog/problems/sets/intersect_3/common.py index 4bb9069..e30e3dc 100644 --- a/prolog/problems/sets/intersect_3/common.py +++ b/prolog/problems/sets/intersect_3/common.py @@ -47,6 +47,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/sets/is_subset_2/common.py b/prolog/problems/sets/is_subset_2/common.py index 9e21584..aee4e81 100644 --- a/prolog/problems/sets/is_subset_2/common.py +++ b/prolog/problems/sets/is_subset_2/common.py @@ -41,6 +41,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/sets/is_superset_2/common.py b/prolog/problems/sets/is_superset_2/common.py index 48c64a4..db32c8d 100644 --- a/prolog/problems/sets/is_superset_2/common.py +++ b/prolog/problems/sets/is_superset_2/common.py @@ -41,6 +41,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/sets/powerset_2/common.py b/prolog/problems/sets/powerset_2/common.py index 6208c0f..020b05e 100644 --- a/prolog/problems/sets/powerset_2/common.py +++ b/prolog/problems/sets/powerset_2/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/sets/subset_2/common.py b/prolog/problems/sets/subset_2/common.py index 6f2fafb..3871880 100644 --- a/prolog/problems/sets/subset_2/common.py +++ b/prolog/problems/sets/subset_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/sets/union_3/common.py b/prolog/problems/sets/union_3/common.py index 8df6b53..30780dc 100644 --- a/prolog/problems/sets/union_3/common.py +++ b/prolog/problems/sets/union_3/common.py @@ -44,6 +44,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