I can now use keyword in concept definition and parsing

This commit is contained in:
2020-05-22 15:46:04 +02:00
parent 37d3d16e21
commit 3ce6ce2a76
14 changed files with 127 additions and 45 deletions
+18
View File
@@ -215,6 +215,24 @@ class TestAtomsParser(TestUsingMemoryBasedSheerka):
expected_array = compute_expected_array(concepts_map, "one", ["one"])
assert lexer_nodes == expected_array
def test_i_can_parse_concepts_with_keyword(self):
concepts_map = {
"a special concept": Concept("a special concept"),
"isa": Concept("isa"),
}
sheerka, context, parser = self.init_parser(concepts_map)
res = parser.parse(context, "a special concept")
lexer_nodes = res.body.body
expected_array = compute_expected_array(concepts_map, "a special concept", ["a special concept"])
assert lexer_nodes == expected_array
res = parser.parse(context, "isa")
lexer_nodes = res.body.body
expected_array = compute_expected_array(concepts_map, "isa", ["isa"])
assert lexer_nodes == expected_array
@pytest.mark.parametrize("text", [
"foo",
f"foo one",