Added ExactConceptParser

This commit is contained in:
2019-11-09 17:29:50 +01:00
parent a636198222
commit 576ce77740
12 changed files with 603 additions and 169 deletions
+13 -8
View File
@@ -37,8 +37,7 @@ def test_root_folder_is_created_after_initialization():
def test_lists_of_concepts_is_initialized():
sheerka = Sheerka()
sheerka.initialize(root_folder)
sheerka = get_sheerka()
assert len(sheerka.concepts_cache) > 1
@@ -53,14 +52,13 @@ def get_concept():
return x+y
func(a,b)
"""
parser = DefaultParser(text, PythonParser)
return parser.parse()
parser = DefaultParser(PythonParser)
return parser.parse(None, text)
def test_i_can_add_a_concept():
sheerka = get_sheerka()
concept = get_concept()
sheerka = Sheerka()
sheerka.initialize(root_folder)
res = sheerka.add_concept(ExecutionContext(sheerka, "xxx"), concept)
concept_found = res.value
@@ -76,7 +74,7 @@ def test_i_can_add_a_concept():
assert isinstance(concept_found.codes[ConceptParts.POST], ast.Expression)
assert isinstance(concept_found.codes[ConceptParts.BODY], ast.Module)
all_props = [p.name for p in concept_found.props]
all_props = list(concept_found.props.keys())
assert all_props == ["a", "b"]
assert concept_found.key == "__var__0 + __var__1"
@@ -123,7 +121,14 @@ def test_i_can_instantiate_a_concept():
"""
Test the new() functionnality
make sure that some Concept are singleton (ex Sheerka, True, False)
but some other need a new instance everytime
otherwise, make sure that new() returns a **new** instance
:return:
"""
pass
def get_sheerka():
sheerka = Sheerka()
sheerka.initialize(root_folder)
return sheerka