cliffxuan / fuxi

Automatically exported from code.google.com/p/fuxi
0 stars 0 forks source link

Bug in ReteNetwork.reset() with newInferredFacts #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
if newInferredFacts is the empty graph, the test will fail and
self.inferredFacts will be initialised to a fresh instance

diff -r ade3a47cc712 lib/Rete/Network.py
--- a/lib/Rete/Network.py       Mon Jun 07 20:53:49 2010 -0400
+++ b/lib/Rete/Network.py       Thu Jul 22 17:38:55 2010 +0100
@@ -442,7 +442,7 @@
                 node.memories[RIGHT_MEMORY].reset()
         self.justifications = {}
         self.proofTracers = {}
-        self.inferredFacts = newinferredFacts and newinferredFacts or Graph()
+        self.inferredFacts = newinferredFacts is not None and newinferredFacts 
or Graph()
         self.workingMemory = set()
         self._resetinstanciationStats()        

Original issue reported on code.google.com by wwai...@gmail.com on 22 Jul 2010 at 4:41

GoogleCodeExporter commented 9 years ago
regression tests are a Good Thing (tm). Of course the above patch is bad. 
Attached is one that works properly

Original comment by wwai...@gmail.com on 28 Jul 2010 at 1:36

Attachments:

GoogleCodeExporter commented 9 years ago
See: 
http://code.google.com/p/fuxi/source/detail?r=781be253fe4b15304b8679b84993794322
47a148

Original comment by chime...@gmail.com on 1 Aug 2010 at 6:07

GoogleCodeExporter commented 9 years ago
Minor nit, the buggy line is still there above the fixed one:

--- a/lib/Rete/Network.py       Sun Aug 01 02:04:00 2010 -0400
+++ b/lib/Rete/Network.py       Sun Aug 01 12:24:07 2010 +0100
@@ -442,7 +442,6 @@
                 node.memories[RIGHT_MEMORY].reset()
         self.justifications = {}
         self.proofTracers = {}
-        self.inferredFacts = newinferredFacts and newinferredFacts or Graph()
         self.inferredFacts = newinferredFacts if newinferredFacts is not None else Graph()
         self.workingMemory = set()
         self._resetinstanciationStats()        

Original comment by wwai...@gmail.com on 1 Aug 2010 at 11:26