From bc88bfc97fdc0712a4c50b58d1742cd18e1da1ed Mon Sep 17 00:00:00 2001 From: Bowen Xu Date: Mon, 13 Nov 2023 16:39:15 -0500 Subject: [PATCH 1/3] bug fix --- pynars/NARS/InferenceEngine/GeneralEngine/GeneralEngine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pynars/NARS/InferenceEngine/GeneralEngine/GeneralEngine.py b/pynars/NARS/InferenceEngine/GeneralEngine/GeneralEngine.py index 6bd3297..56eba53 100644 --- a/pynars/NARS/InferenceEngine/GeneralEngine/GeneralEngine.py +++ b/pynars/NARS/InferenceEngine/GeneralEngine/GeneralEngine.py @@ -112,7 +112,8 @@ def match(cls, task: Task, belief: Belief, term_belief: Term, task_link, term_li if task == belief: if task.sentence.punct == belief.sentence.punct: is_revision = revisible(task, belief) - elif task.term.equal(belief.term): + elif task.term.identical(belief.term): + # elif task.term.equal(belief.term): # TODO: here pass elif not belief.evidential_base.is_overlaped(task.evidential_base): From 33d0ce4ac544c4a183aa7a5225f19de87c893816 Mon Sep 17 00:00:00 2001 From: Maxim Tarasov Date: Tue, 14 Nov 2023 10:12:47 -0800 Subject: [PATCH 2/3] increase processing time for some tests --- Tests/test_NAL/test_NAL4.py | 14 +++++++------- Tests/test_NAL/test_NAL5.py | 8 ++++---- Tests/test_NAL/test_NAL6.py | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Tests/test_NAL/test_NAL4.py b/Tests/test_NAL/test_NAL4.py index c96e0ee..2b0347f 100644 --- a/Tests/test_NAL/test_NAL4.py +++ b/Tests/test_NAL/test_NAL4.py @@ -41,7 +41,7 @@ def test_structural_transformation_0(self): tasks_derived = process_two_premises( '<(*,acid, base) --> reaction>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( @@ -69,7 +69,7 @@ def test_structural_transformation_1(self): tasks_derived = process_two_premises( ' (/,reaction,_,base)>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( @@ -93,7 +93,7 @@ def test_structural_transformation_2(self): tasks_derived = process_two_premises( ' (/,reaction,_,base)>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( @@ -117,7 +117,7 @@ def test_structural_transformation_3(self): tasks_derived = process_two_premises( ' (/,reaction,acid,_)>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( @@ -165,7 +165,7 @@ def test_structural_transformation_5(self): tasks_derived = process_two_premises( '<(\,neutralization,_,base) --> acid>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( @@ -189,7 +189,7 @@ def test_structural_transformation_6(self): tasks_derived = process_two_premises( '<(\,neutralization,acid,_) --> base>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( @@ -213,7 +213,7 @@ def test_structural_transformation_7(self): tasks_derived = process_two_premises( '<(\,neutralization,acid,_) --> base>. %1.00;0.90%', None, - 6 + 10 ) self.assertTrue( diff --git a/Tests/test_NAL/test_NAL5.py b/Tests/test_NAL/test_NAL5.py index ae9fb42..e60d22d 100644 --- a/Tests/test_NAL/test_NAL5.py +++ b/Tests/test_NAL/test_NAL5.py @@ -340,7 +340,7 @@ def test_conditional_analogy(self): tasks_derived = process_two_premises( ' bird>. %1.00;0.90%', '< bird> <=> [flying]>>. %0.80;0.90%', - 6 + 10 ) self.assertTrue( output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') @@ -349,7 +349,7 @@ def test_conditional_analogy(self): tasks_derived = process_two_premises( '< bird> <=> [flying]>>. %0.80;0.90%', ' bird>. %1.00;0.90%', - 6 + 10 ) self.assertTrue( output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') @@ -358,7 +358,7 @@ def test_conditional_analogy(self): tasks_derived = process_two_premises( ' bird>. %1.00;0.90%', '< [flying]> <=> bird>>. %0.80;0.90%', - 6 + 10 ) self.assertTrue( output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') @@ -368,7 +368,7 @@ def test_conditional_analogy(self): tasks_derived = process_two_premises( '< [flying]> <=> bird>>. %0.80;0.90%', ' bird>. %1.00;0.90%', - 6 + 10 ) self.assertTrue( output_contains(tasks_derived, ' [flying]>. %0.80;0.65%') diff --git a/Tests/test_NAL/test_NAL6.py b/Tests/test_NAL/test_NAL6.py index e72c17a..fe4db67 100644 --- a/Tests/test_NAL/test_NAL6.py +++ b/Tests/test_NAL/test_NAL6.py @@ -30,7 +30,7 @@ def test_unification_0(self): tasks_derived = process_two_premises( '<<$x --> bird> ==> <$x --> flyer>>. %1.00;0.90%', '<<$y --> bird> ==> <$y --> flyer>>. %0.00;0.70%', - 2 + 20 ) self.assertTrue( output_contains(tasks_derived, '<<$1 --> bird> ==> <$1 --> flyer>>. %0.79;0.92%') @@ -59,7 +59,7 @@ def test_unification_1(self): tasks_derived = process_two_premises( '<<$x --> bird> ==> <$x --> animal>>. %1.00;0.90%', '<<$y --> robin> ==> <$y --> bird>>. %1.00;0.90%', - 10 + 20 ) self.assertTrue( output_contains(tasks_derived, '<<$0 --> robin> ==> <$0 --> animal>>. %1.00;0.81%') @@ -105,7 +105,7 @@ def test_unification_2(self): tasks_derived = process_two_premises( '<<$x --> swan> ==> <$x --> bird>>. %1.00;0.80% ', '<<$y --> swan> ==> <$y --> swimmer>>. %0.80;0.90%', - 10 + 20 ) self.assertTrue( @@ -156,7 +156,7 @@ def test_unification_3(self): tasks_derived = process_two_premises( '< $x> ==> $x>>. %1.00;0.90%', '< $y> ==> $y>>. %0.70;0.90%', - 10 + 20 ) self.assertTrue( @@ -194,7 +194,7 @@ def test_unification_4(self): tasks_derived = process_two_premises( '<(&&,<$x --> flyer>,<$x --> [chirping]>) ==> <$x --> bird>>. %1.00;0.90%', '<<$y --> [with_wings]> ==> <$y --> flyer>>. %1.00;0.90%', - 10 + 20 ) self.assertTrue( @@ -225,7 +225,7 @@ def test_unification_5(self): tasks_derived = process_two_premises( '<(&&,<$x --> flyer>,<$x --> [chirping]>, <(*, $x, worms) --> food>) ==> <$x --> bird>>. %1.00;0.90%', '<(&&,<$x --> [chirping]>,<$x --> [with_wings]>) ==> <$x --> bird>>. %1.00;0.90%', - 10 + 20 ) self.assertTrue( @@ -267,7 +267,7 @@ def test_unification_6(self): tasks_derived = process_two_premises( '<(&&,<$x --> flyer>,<(*,$x,worms) --> food>) ==> <$x --> bird>>. %1.00;0.90%', '<<$y --> flyer> ==> <$y --> [with_wings]>>. %1.00;0.90%', - 10 + 20 ) self.assertTrue( @@ -556,7 +556,7 @@ def test_multiple_variable_elimination_2(self): tasks_derived = process_two_premises( '(&&,<#x --> (/,open,#y,_)>,<#x --> lock>,<#y --> key>).', '<{lock1} --> lock>.', - 10 + 100 ) self.assertTrue( @@ -842,7 +842,7 @@ def test_second_level_variable_unification_1(self): tasks_derived = process_two_premises( '<<$1 --> lock> ==> (&&,<#2 --> key>,<$1 --> (/,open,#2,_)>)>. %1.00;0.90%', '<{key1} --> key>. %1.00;0.90% ', - 10 + 100 ) self.assertTrue( @@ -924,7 +924,7 @@ def test_variable_elimination_deduction_0(self): tasks_derived = process_two_premises( '<(&&,<#1 --> A>, <#1 --> B>) ==> C>. %1.00;0.90%', ' A>. %1.00;0.90%', - 10 + 100 ) self.assertTrue( @@ -984,7 +984,7 @@ def test_abduction_with_variable_elimination_abduction_0(self): tasks_derived = process_two_premises( '<(&&,<#1 --> A>,<#1 --> B>) ==> C>. %1.00;0.90%', '< A> ==> C>. %1.00;0.90%', - 100 + 150 ) self.assertTrue( From 68aefd67eb2aff02c529e047b7d419a786285b8d Mon Sep 17 00:00:00 2001 From: Maxim Tarasov Date: Tue, 14 Nov 2023 10:16:06 -0800 Subject: [PATCH 3/3] add verbose flag to unittest workflow --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 3c8a64d..dd271d8 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -36,4 +36,4 @@ jobs: #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with unittest run: | - python -m unittest discover Tests/test_NAL/ -p "test_*.py" + python -m unittest discover Tests/test_NAL/ -p "test_*.py" -v