Fixed some misbehaviours regarding question() + added #import functionality when restoring

This commit is contained in:
2020-09-23 20:08:15 +02:00
parent 17c74d3808
commit eeeed0f110
20 changed files with 164 additions and 83 deletions
+5 -3
View File
@@ -119,7 +119,7 @@ class TestAddConceptEvaluator(TestUsingMemoryBasedSheerka):
def_concept_return_value = self.get_def_concept(
name="x plus y",
where=self.pretval(Concept("u is a v").def_var("u").def_var("v"), source="x is a number"),
body=self.pretval(Concept("add a b").def_var("a").def_var("b"), source="add x y"),)
body=self.pretval(Concept("add a b").def_var("a").def_var("b"), source="add x y"), )
evaluated = AddConceptEvaluator().eval(context, def_concept_return_value)
@@ -186,8 +186,10 @@ class TestAddConceptEvaluator(TestUsingMemoryBasedSheerka):
@pytest.mark.parametrize("expression, name, expected", [
("isinstance(a, str)", "a b", {"a"}),
("a.location=b", "a is in b", {"a", "b"}),
("a.location=b", "'a' is in b", {"b"}),
("a.location = b", "a is in b", {"a", "b"}),
("a.location = b", "'a' is in b", {"b"}),
("date.today()", "what is the date", set()),
("a.location", "where is a", {"a"})
])
def test_i_can_get_variables_from_python_node_when_long_name(self, expression, name, expected):
ret_val = self.get_concept_part(expression)
@@ -45,5 +45,6 @@ class TestPrepareEvalQuestionEvaluator(TestUsingMemoryBasedSheerka):
assert res.body.body == expected
assert BuiltinConcepts.EVAL_QUESTION_REQUESTED in context.protected_hints
assert BuiltinConcepts.EVAL_UNTIL_SUCCESS_REQUESTED in context.protected_hints
assert BuiltinConcepts.EVAL_BODY_REQUESTED in context.protected_hints
assert BuiltinConcepts.RETURN_BODY_REQUESTED in context.protected_hints