Fixed RET functionnality misbehaviour

This commit is contained in:
2020-07-08 13:35:18 +02:00
parent c4399d631c
commit b768eaa95d
14 changed files with 113 additions and 29 deletions
+23 -1
View File
@@ -1,6 +1,6 @@
import pytest
from core.builtin_concepts import BuiltinConcepts
from core.concept import Concept, PROPERTIES_TO_SERIALIZE, simplec, CMV, NotInit
from core.concept import Concept, PROPERTIES_TO_SERIALIZE, simplec, CMV, NotInit, CC
from evaluators.MutipleSameSuccessEvaluator import MultipleSameSuccessEvaluator
from evaluators.PythonEvaluator import PythonEvalError
from parsers.BaseNodeParser import SyaAssociativity
@@ -976,6 +976,28 @@ as:
assert res[0].status
assert sheerka.isa(sheerka.new("one"), sheerka.new("number"))
def test_i_can_evaluate_sya_and_ret_concepts(self):
init = [
"def concept one as 1",
"def concept plus from a plus b as a + b",
"def concept the a ret a"
]
sheerka = self.init_scenario(init)
the = sheerka.get_by_name("the a")
# res = sheerka.evaluate_user_input("one plus the one")
# assert res[0].status
# plus = res[0].body
# assert isinstance(plus, Concept)
# assert plus.name == "plus"
# assert plus.compiled["a"] == sheerka.new("one")
# assert plus.compiled["b"] == CC(the, a=sheerka.new("one"))
res = sheerka.evaluate_user_input("eval one plus the one")
assert res[0].status
assert res[0].body == 2
class TestSheerkaNonRegFile(TestUsingFileBasedSheerka):
def test_i_can_def_several_concepts(self):