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
+26
View File
@@ -161,6 +161,32 @@ class TestExactConceptParser(TestUsingMemoryBasedSheerka):
assert concept_found.metadata.need_validation
assert not concept_found.metadata.is_evaluated
def test_i_can_parse_when_expression_contains_keyword(self):
sheerka, context, isa, def_concept = self.init_concepts(
Concept("c is a concept").def_var("c"),
Concept("def concept a").def_var("a"),
)
source = "z is a concept"
results = ExactConceptParser().parse(context, source)
concept_found = results[0].value.value
assert len(results) == 1
assert results[0].status
assert concept_found == CMV(isa, c="z")
assert concept_found.metadata.need_validation
assert not concept_found.metadata.is_evaluated
source = "def concept z"
results = ExactConceptParser().parse(context, source)
concept_found = results[0].value.value
assert len(results) == 1
assert results[0].status
assert concept_found == CMV(def_concept, a="z")
assert concept_found.metadata.need_validation
assert not concept_found.metadata.is_evaluated
def test_i_can_manage_unknown_concept(self):
context = self.get_context(self.get_sheerka(singleton=True))
source = "def concept hello" # this is not a concept by itself