Fixed #131 : Implement ExprToConditions

Fixed #130 : ArithmeticOperatorParser
Fixed #129 : python_wrapper : create_namespace
Fixed #128 : ExpressionParser: Cannot parse func(x) infixed concept 'xxx'
This commit is contained in:
2021-10-13 16:06:57 +02:00
parent a61a1c0d2b
commit 89e1f20975
76 changed files with 5867 additions and 3206 deletions
+18 -18
View File
@@ -27,17 +27,17 @@ class TestPrepareEvalCommon(TestUsingMemoryBasedSheerka):
def test_i_can_update_process_when_evaluating_a_concept(self):
sheerka, context, foo = self.init_concepts("foo")
eval_context = context.push(BuiltinConcepts.EVALUATING_CONCEPT, foo, desc=f"some desc")
parsing_prop_context = eval_context.push(BuiltinConcepts.PARSING, {"prop": ConceptParts.BODY})
level1 = parsing_prop_context.push(BuiltinConcepts.TESTING, "some stuff")
level2 = level1.push(BuiltinConcepts.TESTING, "some stuff") # another level for the fun
eval_ctx = context.push(BuiltinConcepts.EVALUATING_CONCEPT, foo, desc=f"some desc")
parsing_prop_ctx = eval_ctx.push(BuiltinConcepts.PARSE_CODE, {"concept": foo, "prop": ConceptParts.BODY})
level1_ctx = parsing_prop_ctx.push(BuiltinConcepts.TESTING, "some stuff")
level2_ctx = level1_ctx.push(BuiltinConcepts.TESTING, "some stuff") # another level for the fun
PrepareEvalCommon.update_context_hints(level2, "prop_name", ["to_put_in_context"])
PrepareEvalCommon.update_context_hints(level2_ctx, "prop_name", ["to_put_in_context"])
assert not context.in_context("to_put_in_context")
assert not eval_context.in_context("to_put_in_context")
assert not parsing_prop_context.in_context("to_put_in_context")
assert not level1.in_context("to_put_in_context")
assert not level2.in_context("to_put_in_context")
assert not eval_ctx.in_context("to_put_in_context")
assert not parsing_prop_ctx.in_context("to_put_in_context")
assert not level1_ctx.in_context("to_put_in_context")
assert not level2_ctx.in_context("to_put_in_context")
assert foo.get_compiled_context_hints() == {ConceptParts.BODY: ["to_put_in_context"]}
def test_i_can_update_for_the_correct_variable(self):
@@ -45,15 +45,15 @@ class TestPrepareEvalCommon(TestUsingMemoryBasedSheerka):
# use this name, rather than the attribute being parsed
sheerka, context, foo = self.init_concepts(Concept("foo").def_var("var_name"))
eval_context = context.push(BuiltinConcepts.EVALUATING_CONCEPT, foo, desc=f"some desc")
parsing_prop_context = eval_context.push(BuiltinConcepts.PARSING, {"prop": ConceptParts.BODY})
level1 = parsing_prop_context.push(BuiltinConcepts.TESTING, "some stuff")
level2 = level1.push(BuiltinConcepts.TESTING, "some stuff") # another level for the fun
eval_ctx = context.push(BuiltinConcepts.EVALUATING_CONCEPT, foo, desc=f"some desc")
parsing_prop_ctx = eval_ctx.push(BuiltinConcepts.PARSE_CODE, {"concept": foo, "prop": ConceptParts.BODY})
level1_ctx = parsing_prop_ctx.push(BuiltinConcepts.TESTING, "some stuff")
level2_ctx = level1_ctx.push(BuiltinConcepts.TESTING, "some stuff") # another level for the fun
PrepareEvalCommon.update_context_hints(level2, "var_name", ["to_put_in_context"])
PrepareEvalCommon.update_context_hints(level2_ctx, "var_name", ["to_put_in_context"])
assert not context.in_context("to_put_in_context")
assert not eval_context.in_context("to_put_in_context")
assert not parsing_prop_context.in_context("to_put_in_context")
assert not level1.in_context("to_put_in_context")
assert not level2.in_context("to_put_in_context")
assert not eval_ctx.in_context("to_put_in_context")
assert not parsing_prop_ctx.in_context("to_put_in_context")
assert not level1_ctx.in_context("to_put_in_context")
assert not level2_ctx.in_context("to_put_in_context")
assert foo.get_compiled_context_hints() == {"var_name": ["to_put_in_context"]}