Implemented SheerkaOntology

This commit is contained in:
2021-01-11 15:36:03 +01:00
parent e3c2adb533
commit e26c83a825
119 changed files with 6876 additions and 2002 deletions
+6 -6
View File
@@ -68,8 +68,8 @@ class TestPythonEvaluator(TestUsingMemoryBasedSheerka):
assert PythonEvaluator().matches(context, ret_val) == expected
@pytest.mark.parametrize("text, expected", [
# ("1 + 1", 2),
# ("test()", "I have access to Sheerka !"),
("1 + 1", 2),
("test()", "I have access to Sheerka !"),
("sheerka.test()", "I have access to Sheerka !"),
("a=10\na", 10),
("Concept('foo')", Concept('foo')),
@@ -131,7 +131,7 @@ class TestPythonEvaluator(TestUsingMemoryBasedSheerka):
assert evaluated.value == "I have access to Sheerka ! param='value for param', event='xxx'."
def test_i_can_eval_using_context_when_self_is_not_sheerka(self):
sheerka, context = self.init_concepts()
sheerka, context = self.init_test().unpack()
parsed = PythonParser().parse(context, ParserInput("create_new_concept(Concept('foo'))"))
evaluated = PythonEvaluator().eval(context, parsed)
@@ -230,7 +230,7 @@ class TestPythonEvaluator(TestUsingMemoryBasedSheerka):
'c:__var__0 mult __var__1|1002:': 2}
def test_i_can_define_variables(self):
sheerka, context = self.init_concepts()
sheerka, context = self.init_test().unpack()
parsed = PythonParser().parse(context, ParserInput("a=10"))
python_evaluator = PythonEvaluator()
@@ -293,7 +293,7 @@ class TestPythonEvaluator(TestUsingMemoryBasedSheerka):
assert error1.concepts == {'foo': 'string'}
def test_i_can_use_sheerka_locals(self):
sheerka, context = self.init_concepts()
sheerka, context = self.init_test().unpack()
def func(i):
return i + 1
@@ -318,7 +318,7 @@ class TestPythonEvaluator(TestUsingMemoryBasedSheerka):
assert evaluated.value == "I have access to Sheerka ! param=(1001)one, event='xxx'."
def test_i_can_eval_rules_from_python_parser(self):
sheerka, context = self.init_concepts()
sheerka, context = self.init_test().unpack()
parsed_ret_val = PythonParser().parse(context, ParserInput("r:|1:.id"))
assert parsed_ret_val.status