Added ExactConceptParser
This commit is contained in:
+13
-8
@@ -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
|
||||
Reference in New Issue
Block a user