Implemented some enhancement request and fixed some bugs

Fixed #2 : Variables are not recognized when inside a rule token
Fixed #15 : Rule: rete attributes are lost when a new ontology is created
Fixed #14 : ReteNetwork: Format rules must not be added to Rete network
Fixed #16 : DefConcept: Variables are not recognized when they are keyword arguments
Fixed #4 : Comparison are not correctly set when comparison property is a concept
Fixed #14 : Parser: merge FunctionParser.NamesNode and ExpressionParser.NamesNode
Fixed #18 : Parser: Add SourceCodeNode test to UnrecognizedNodeParser
Fixed #20 : At startup Number concept is saved in db a numerous number of time
Fixed #21 : CacheManager: I can remove all elements from a ListIfNeededCache and fill it again
Fixed #22 : CacheManager: I can remove all elements from a SetCache and fill it again
Fixed #23 : HistoryManager: history() no longer works
Fixed #24 : HistoryManager: history() no longer works after creating an exec rule
Fixed #25 : SheerkaMemory: Use MemoryObject instead of sheerka.local
Fixed #26 : Debugger: add the list all available services..
Fixed #27 : CONCEPTS_GRAMMARS_ENTRY does not seems to be in use any more
Fixed #28 : Give order to services
This commit is contained in:
2021-02-12 15:15:31 +01:00
parent 3a12ea58df
commit cac2dad17f
62 changed files with 1182 additions and 480 deletions
-8
View File
@@ -8,10 +8,8 @@ from core.builtin_concepts_ids import AllBuiltinConcepts
from core.concept import Concept, PROPERTIES_TO_SERIALIZE, ConceptParts, get_concept_attrs
from core.global_symbols import NotInit
from core.sheerka.Sheerka import Sheerka, BASE_NODE_PARSER_CLASS
from core.sheerka.SheerkaOntologyManager import OntologyAlreadyExists
from core.sheerka.services.SheerkaConceptManager import SheerkaConceptManager
from core.tokenizer import Token, TokenKind
from tests.TestUsingFileBasedSheerka import TestUsingFileBasedSheerka
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
@@ -370,12 +368,10 @@ class TestSheerkaUsingMemoryBasedSheerka(TestUsingMemoryBasedSheerka):
assert sheerka.isinstance(res.body, BuiltinConcepts.SUCCESS)
foo = sheerka.create_new_concept(context, Concept("foo").def_var("a").def_var("b")).body.body
sheerka.locals = {"key1": "value1"}
# sanity check
assert sheerka.get_by_name("foo") == foo
assert not sheerka.is_known(sheerka.get_by_name("bar"))
assert sheerka.locals == {"key1": "value1"}
assert get_concept_attrs(foo) == ["a", "b"]
# record the ontology
@@ -386,12 +382,10 @@ class TestSheerkaUsingMemoryBasedSheerka(TestUsingMemoryBasedSheerka):
sheerka.push_ontology(context, "another ontology")
foo2 = sheerka.create_new_concept(context, Concept("foo").def_var("a").def_var("b").def_var("c")).body.body
bar = sheerka.create_new_concept(context, Concept("bar")).body.body
sheerka.locals = {"key2": "value2"}
# sanity check
assert sheerka.get_by_name("foo") == foo2
assert sheerka.get_by_name("bar") == bar
assert sheerka.locals == {"key2": "value2"}
assert get_concept_attrs(foo) == ["a", "b", "c"]
# put pack the previous ontology
@@ -399,14 +393,12 @@ class TestSheerkaUsingMemoryBasedSheerka(TestUsingMemoryBasedSheerka):
assert sheerka.get_by_name("foo") == foo # not [foo, foo2], foo2 is not seen !!!
assert sheerka.get_by_name("bar") == bar
assert sheerka.locals == {"key1": "value1"}
assert get_concept_attrs(foo) == ["a", "b"]
# sanity check
sheerka.pop_ontology(context)
assert sheerka.get_by_name("foo") == foo2
assert sheerka.get_by_name("bar") == bar
assert sheerka.locals == {"key2": "value2"}
assert get_concept_attrs(foo) == ["a", "b", "c"]
def test_adding_the_same_ontology_twice_has_no_effect(self):