diff --git a/Tests/test_NAL/test_BUG_NAL4.py b/Tests/test_NAL/test_BUG_NAL4.py index b9a280f..3f72d3f 100644 --- a/Tests/test_NAL/test_BUG_NAL4.py +++ b/Tests/test_NAL/test_BUG_NAL4.py @@ -21,6 +21,9 @@ class TEST_BUG_NAL4(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_bug_0(self): ''' diff --git a/Tests/test_NAL/test_NAL1.py b/Tests/test_NAL/test_NAL1.py index be384af..d3f3be4 100644 --- a/Tests/test_NAL/test_NAL1.py +++ b/Tests/test_NAL/test_NAL1.py @@ -18,6 +18,8 @@ # utils_for_test.engine = RuleMap() class TEST_NAL1(unittest.TestCase): + def setUp(self): + nars.reset() def test_revision(self): ''' diff --git a/Tests/test_NAL/test_NAL2.py b/Tests/test_NAL/test_NAL2.py index 342c61d..84d7a7e 100644 --- a/Tests/test_NAL/test_NAL2.py +++ b/Tests/test_NAL/test_NAL2.py @@ -7,6 +7,9 @@ class TEST_NAL2(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_revision(self): diff --git a/Tests/test_NAL/test_NAL3.py b/Tests/test_NAL/test_NAL3.py index c35f7c3..b11ec0a 100644 --- a/Tests/test_NAL/test_NAL3.py +++ b/Tests/test_NAL/test_NAL3.py @@ -19,6 +19,9 @@ class TEST_NAL3(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_compound_intersection_extension(self): @@ -154,6 +157,7 @@ def test_compound_decomposition_intensional_intersection(self): output_contains(tasks_derived, ' bird>. %1.00;0.81%') ) + nars.reset() tasks_derived = process_two_premises( ' swimmer>. %0.00;0.90%', @@ -190,6 +194,8 @@ def test_compound_decomposition_extensional_difference(self): output_contains(tasks_derived, ' mammal>. %0.00;0.81%') ) + nars.reset() + tasks_derived = process_two_premises( ' (-,mammal,swimmer)>. %0.00;0.90%', ' swimmer>. %0.00;0.90%', diff --git a/Tests/test_NAL/test_NAL4.py b/Tests/test_NAL/test_NAL4.py index a66dd1b..6b4ee90 100644 --- a/Tests/test_NAL/test_NAL4.py +++ b/Tests/test_NAL/test_NAL4.py @@ -21,6 +21,9 @@ class TEST_NAL4(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_structural_transformation_0(self): diff --git a/Tests/test_NAL/test_NAL5.py b/Tests/test_NAL/test_NAL5.py index e60d22d..7c1f928 100644 --- a/Tests/test_NAL/test_NAL5.py +++ b/Tests/test_NAL/test_NAL5.py @@ -19,6 +19,9 @@ class TEST_NAL5(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_revision(self): @@ -180,6 +183,8 @@ def test_conditional_deduction_0(self): output_contains(tasks_derived, ' animal>. %1.00;0.81%') ) + nars.reset() + tasks_derived = process_two_premises( ' bird>. %1.00;0.90%', '< bird> ==> animal>>. %1.00;0.90%', @@ -346,6 +351,8 @@ def test_conditional_analogy(self): output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') ) + nars.reset() + tasks_derived = process_two_premises( '< bird> <=> [flying]>>. %0.80;0.90%', ' bird>. %1.00;0.90%', @@ -355,6 +362,8 @@ def test_conditional_analogy(self): output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') ) + nars.reset() + tasks_derived = process_two_premises( ' bird>. %1.00;0.90%', '< [flying]> <=> bird>>. %0.80;0.90%', @@ -364,6 +373,7 @@ def test_conditional_analogy(self): output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') ) + nars.reset() tasks_derived = process_two_premises( '< [flying]> <=> bird>>. %0.80;0.90%', @@ -581,6 +591,8 @@ def test_decomposition_1(self): output_contains(tasks_derived, ' swimmer>. %0.00;0.81%') ) + nars.reset() + tasks_derived = process_two_premises( ' [flying]>. %1.00;0.90%', '(&&, [flying]>, swimmer>). %0.00;0.90% ', diff --git a/Tests/test_NAL/test_NAL6.py b/Tests/test_NAL/test_NAL6.py index ee59550..4eb5266 100644 --- a/Tests/test_NAL/test_NAL6.py +++ b/Tests/test_NAL/test_NAL6.py @@ -10,6 +10,9 @@ from pynars.NARS.InferenceEngine.VariableEngine.VariableEngine import VariableEngine class TEST_NAL6(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_unification_0(self): diff --git a/Tests/test_NAL/test_NAL7.py b/Tests/test_NAL/test_NAL7.py index 308320c..381f81c 100644 --- a/Tests/test_NAL/test_NAL7.py +++ b/Tests/test_NAL/test_NAL7.py @@ -10,6 +10,9 @@ # utils_for_test.rule_map = RuleMap_v2() class TEST_NAL7(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_deduction(self): @@ -634,6 +637,9 @@ def test_deduction_sequence(self): pass class TEST_NAL7_ANALOGY(unittest.TestCase): + def setUp(self): + nars.reset() + def test_analogy_0_0__0(self): ''' diff --git a/Tests/test_NAL/test_NAL8.py b/Tests/test_NAL/test_NAL8.py index 130bca7..0b11cb8 100644 --- a/Tests/test_NAL/test_NAL8.py +++ b/Tests/test_NAL/test_NAL8.py @@ -11,6 +11,9 @@ class TEST_NAL8(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_1_0(self): ''' diff --git a/Tests/test_NAL/test_NAL9.py b/Tests/test_NAL/test_NAL9.py index 11331a6..9aee46f 100644 --- a/Tests/test_NAL/test_NAL9.py +++ b/Tests/test_NAL/test_NAL9.py @@ -10,6 +10,9 @@ nars = utils_for_test.nars class TEST_NAL9(unittest.TestCase): + def setUp(self): + nars.reset() + '''''' def test_anticipate_0(self): ''' @@ -76,6 +79,8 @@ def test_doubt_0(self): 100 ) + nars.reset() + tasks_derived = process_two_premises( ' b>?', None, diff --git a/Tests/utils_for_test.py b/Tests/utils_for_test.py index 6cfb9c7..76cc006 100644 --- a/Tests/utils_for_test.py +++ b/Tests/utils_for_test.py @@ -20,8 +20,6 @@ def process_two_premises(premise1: str, premise2: str, n_cycle: int) -> List[Task]: '''''' - nars.reset() - tasks_all_cycles = [] success, task, task_overflow = nars.input_narsese(premise1) @@ -43,7 +41,7 @@ def process_two_premises(premise1: str, premise2: str, n_cycle: int) -> List[Tas if answers_quest is not None: tasks_all_cycles.extend(answers_quest) - return tasks_all_cycles + return [t for t in tasks_all_cycles if t is not None] def rule_map_two_premises(premise1: str, premise2: str, term_common: str, inverse: bool=False, is_belief_term: bool=False, index_task=None, index_belief=None) -> Tuple[List[RuleCallable], Task, Belief, Concept, TaskLink, TermLink, Tuple[Task, Task, Task, Task]]: ''''''