From bcb2308ea52f3ded18edaf01b75235a47a46471e Mon Sep 17 00:00:00 2001 From: Kodjo Sossouvi Date: Tue, 24 Dec 2019 17:14:28 +0100 Subject: [PATCH] Fixed minor bugs --- core/sheerka.py | 2 +- evaluators/PythonEvaluator.py | 2 +- tests/test_PythonEvaluator.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/sheerka.py b/core/sheerka.py index a937457..30ff343 100644 --- a/core/sheerka.py +++ b/core/sheerka.py @@ -495,7 +495,7 @@ class Sheerka(Concept): :return: """ # steps = [BuiltinConcepts.BEFORE_PARSING, BuiltinConcepts.PARSING, BuiltinConcepts.AFTER_PARSING] - steps = [BuiltinConcepts.PARSING] + steps = [BuiltinConcepts.BEFORE_PARSING, BuiltinConcepts.PARSING, BuiltinConcepts.AFTER_PARSING] for part_key in ConceptParts: source = getattr(concept.metadata, part_key.value) if source is None or not isinstance(source, str) or source == "": diff --git a/evaluators/PythonEvaluator.py b/evaluators/PythonEvaluator.py index 7930150..894ab14 100644 --- a/evaluators/PythonEvaluator.py +++ b/evaluators/PythonEvaluator.py @@ -87,7 +87,7 @@ class PythonEvaluator(OneReturnValueEvaluator): evaluated = context.sheerka.evaluate_concept(sub_context, concept, self.verbose_log) if evaluated.key == concept.key: - my_locals[name] = evaluated.body or evaluated # if ConceptParts.BODY not in evaluated.cached_asts else evaluated + my_locals[name] = evaluated.body if ConceptParts.BODY in evaluated.cached_asts else evaluated return my_locals diff --git a/tests/test_PythonEvaluator.py b/tests/test_PythonEvaluator.py index e33188c..dac804e 100644 --- a/tests/test_PythonEvaluator.py +++ b/tests/test_PythonEvaluator.py @@ -89,7 +89,7 @@ def test_i_can_eval_expression_with_that_references_concepts(): :return: """ context = get_context() - context.sheerka.add_in_cache(Concept("foo", body=1)) + context.sheerka.add_in_cache(Concept("foo", body="1")) parsed = PythonParser().parse(context, "foo + 2") evaluated = PythonEvaluator().eval(context, parsed)