Fixed #68: Implement SheerkaQL

Fixed #70: SheerkaFilterManager : Pipe functions
Fixed #71: SheerkaFilterManager : filter_objects
Fixed #75: SheerkaMemory: Enhance memory() to use the filtering capabilities
Fixed #76: SheerkaEvaluateConcept: Concepts that modify the state of the system must not be evaluated during question
This commit is contained in:
2021-04-26 19:13:47 +02:00
parent bef5f3208c
commit 1059ce25c5
57 changed files with 5759 additions and 1302 deletions
+47 -3
View File
@@ -12,9 +12,12 @@ class TestExecutionContext(TestUsingMemoryBasedSheerka):
def test_id_is_incremented_by_event_digest(self):
sheerka = self.get_sheerka()
a = ExecutionContext("foo", Event("event_1"), sheerka, BuiltinConcepts.NOP, None)
b = ExecutionContext("foo", Event("event_1"), sheerka, BuiltinConcepts.NOP, None)
c = ExecutionContext("foo", Event("event_2"), sheerka, BuiltinConcepts.NOP, None)
event1 = Event("event_1")
event2 = Event("event_2")
a = ExecutionContext("foo", event1, sheerka, BuiltinConcepts.NOP, None)
b = ExecutionContext("foo", event1, sheerka, BuiltinConcepts.NOP, None)
c = ExecutionContext("foo", event2, sheerka, BuiltinConcepts.NOP, None)
d = b.push(BuiltinConcepts.NOP, None)
e = c.push(BuiltinConcepts.NOP, None)
@@ -177,6 +180,47 @@ class TestExecutionContext(TestUsingMemoryBasedSheerka):
assert sub2.has_parent(root.id)
assert not sub1.has_parent(sub2.id)
assert not sub2.has_parent(sub1.id)
def test_i_can_reset_global_hints(self):
sheerka = self.get_sheerka()
context = ExecutionContext("foo", Event("event_1"), sheerka, BuiltinConcepts.NOP, None)
context.add_to_global_hints(BuiltinConcepts.TESTING)
context.add_to_global_hints(BuiltinConcepts.DEBUG)
sub_context1 = context.push(BuiltinConcepts.NOP, None)
assert BuiltinConcepts.TESTING in sub_context1.global_hints
assert BuiltinConcepts.DEBUG in sub_context1.global_hints
sub_context2 = context.push(BuiltinConcepts.NOP, None, reset_hints={BuiltinConcepts.TESTING})
assert BuiltinConcepts.TESTING not in sub_context2.global_hints
assert BuiltinConcepts.DEBUG in sub_context2.global_hints
sub_context3 = context.push(BuiltinConcepts.NOP,
None,
reset_hints={BuiltinConcepts.DEBUG, BuiltinConcepts.TESTING})
assert sub_context3.global_hints == set()
def test_i_can_reset_protected_hints(self):
sheerka = self.get_sheerka()
context = ExecutionContext("foo", Event("event_1"), sheerka, BuiltinConcepts.NOP, None)
context.add_to_protected_hints(BuiltinConcepts.TESTING)
context.add_to_protected_hints(BuiltinConcepts.DEBUG)
sub_context1 = context.push(BuiltinConcepts.NOP, None)
assert BuiltinConcepts.TESTING in sub_context1.protected_hints
assert BuiltinConcepts.DEBUG in sub_context1.protected_hints
sub_context2 = context.push(BuiltinConcepts.NOP, None, reset_hints={BuiltinConcepts.TESTING})
assert BuiltinConcepts.TESTING not in sub_context2.protected_hints
assert BuiltinConcepts.DEBUG in sub_context2.protected_hints
sub_context3 = context.push(BuiltinConcepts.NOP,
None,
reset_hints={BuiltinConcepts.DEBUG, BuiltinConcepts.TESTING})
assert sub_context3.protected_hints == set()
# def test_variables_are_passed_to_children_but_not_to_parents(self):
# sheerka = self.get_sheerka()
#