I can now use keyword in concept definition and parsing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user