Concepts bodies are now evaluated on demand
This commit is contained in:
@@ -66,6 +66,31 @@ class TestAddConceptInSetEvaluator(TestUsingMemoryBasedSheerka):
|
||||
foo_from_sheerka = context.sheerka.get("foo")
|
||||
assert foo_from_sheerka.get_prop(BuiltinConcepts.ISA) == [bar]
|
||||
|
||||
def test_i_can_add_bnf_concept_to_a_set_of_concept(self):
|
||||
"""
|
||||
This test is the reason why I have started the whole eval on demand stuff
|
||||
Sheerka tries to evaluate the body but it can (as a and b are not defined)
|
||||
So 'foo' cannot be put is set
|
||||
:return:
|
||||
"""
|
||||
sheerka, context, foo, bar = self.init_concepts(
|
||||
Concept("foo", definition="a plus b", body="a + b").def_prop("a").def_prop("b"),
|
||||
"bar",
|
||||
create_new=True)
|
||||
|
||||
ret_val = get_ret_val("foo", "bar")
|
||||
res = AddConceptInSetEvaluator().eval(context, ret_val)
|
||||
foo = sheerka.new("foo") # reload it
|
||||
|
||||
assert res.status
|
||||
assert context.sheerka.isinstance(res.value, BuiltinConcepts.SUCCESS)
|
||||
assert context.sheerka.isaset(context, bar)
|
||||
assert context.sheerka.isinset(foo, bar)
|
||||
assert context.sheerka.isa(foo, bar)
|
||||
|
||||
foo_from_sheerka = context.sheerka.get("foo")
|
||||
assert foo_from_sheerka.get_prop(BuiltinConcepts.ISA) == [bar]
|
||||
|
||||
def test_i_can_add_concept_with_a_body_to_a_set_of_concept(self):
|
||||
context = self.get_context()
|
||||
foo = Concept("foo", body="1")
|
||||
|
||||
Reference in New Issue
Block a user