Fixed #125: SheerkaErrorManager

Fixed #135: Change services service priorities
Fixed #136: ErrorManager: Implement recognize_error
Fixed #137: BNFNodeParser : Error when parsing regex with sub parsers
Fixed #138: get_last_errors(): real errors sources are lost
Fixed #139: OneError return value removes the origin of the error
Fixed #140: Concept variables are not correctly handled when parsing sub expression
Fixed #143: Implement has_unknown_concepts()
This commit is contained in:
2021-10-28 14:04:41 +02:00
parent 48ab72fd9c
commit 87cab44fb8
56 changed files with 1391 additions and 1286 deletions
+29 -3
View File
@@ -3,11 +3,10 @@ from core.builtin_helpers import ensure_evaluated
from core.concept import Concept
from core.global_symbols import NotFound
from core.sheerka.ExecutionContext import ExecutionContext
from core.sheerka.services.SheerkaMemory import SheerkaMemory, MemoryObject
from core.sheerka.services.SheerkaMemory import MemoryObject, SheerkaMemory
from tests.TestUsingFileBasedSheerka import TestUsingFileBasedSheerka
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
from tests.parsers.parsers_utils import CV, compare_with_test_object, CB
from tests.parsers.parsers_utils import CB, CV, compare_with_test_object
class TestSheerkaMemory(TestUsingMemoryBasedSheerka):
@@ -92,6 +91,33 @@ class TestSheerkaMemory(TestUsingMemoryBasedSheerka):
foo)}
assert id(sheerka.get_from_memory(context, "a").obj) == id(foo)
# another object is appended
bar = Concept("bar")
sheerka.add_to_memory(context, "a", bar)
assert sheerka.om.copy(SheerkaMemory.OBJECTS_ENTRY) == {
"a": [
MemoryObject(context.event.get_digest(), context.event.date.timestamp(), foo),
MemoryObject(context.event.get_digest(), context.event.date.timestamp(), bar)
]}
def test_i_can_set_and_retrieve_from_memory(self):
sheerka, context = self.init_test().unpack()
assert sheerka.get_from_memory(context, "a") is NotFound
foo = Concept("foo")
sheerka.set_in_memory(context, "a", foo)
assert sheerka.om.copy(SheerkaMemory.OBJECTS_ENTRY) == {"a": MemoryObject(context.event.get_digest(),
context.event.date.timestamp(),
foo)}
assert id(sheerka.get_from_memory(context, "a").obj) == id(foo)
# another object replace the first one
sheerka.set_in_memory(context, "a", "foo")
assert sheerka.om.copy(SheerkaMemory.OBJECTS_ENTRY) == {"a": MemoryObject(context.event.get_digest(),
context.event.date.timestamp(),
"foo")}
def test_i_can_use_memory_with_a_string(self):
sheerka, context = self.init_test().unpack()