Initialized logging
This commit is contained in:
+13
-7
@@ -32,13 +32,12 @@ def init_test():
|
||||
def test_root_folder_is_created_after_initialization():
|
||||
return_value = Sheerka().initialize(root_folder)
|
||||
assert return_value.status, "initialisation should be successful"
|
||||
assert Sheerka().concept_equals(return_value.value, Sheerka().get_concept("success"))
|
||||
assert os.path.exists(root_folder), "init folder should be created"
|
||||
|
||||
|
||||
def test_lists_of_concepts_is_initialized():
|
||||
Sheerka().initialize(root_folder)
|
||||
assert len(Sheerka().concepts) > 1
|
||||
assert len(Sheerka().concepts_cache) > 1
|
||||
|
||||
|
||||
# def test_null_concept_are_equals():
|
||||
@@ -74,18 +73,25 @@ def test_i_can_add_a_concept():
|
||||
sheerka = Sheerka()
|
||||
sheerka.initialize(root_folder)
|
||||
res = sheerka.add_concept(concept)
|
||||
concept_found = res.value
|
||||
|
||||
assert res.status
|
||||
assert res.value == Concept(
|
||||
assert concept_found == Concept(
|
||||
name="a + b",
|
||||
where="isinstance(a, int) and isinstance(b, int)",
|
||||
pre="isinstance(a, int) and isinstance(b, int)",
|
||||
post="isinstance(res, int)",
|
||||
body="def func(x,y):\n return x+y\nfunc(a,b)")
|
||||
assert isinstance(res.value.codes[ConceptParts.WHERE], ast.Expression)
|
||||
assert isinstance(res.value.codes[ConceptParts.PRE], ast.Expression)
|
||||
assert isinstance(res.value.codes[ConceptParts.POST], ast.Expression)
|
||||
assert isinstance(res.value.codes[ConceptParts.BODY], ast.Module)
|
||||
assert isinstance(concept_found.codes[ConceptParts.WHERE], ast.Expression)
|
||||
assert isinstance(concept_found.codes[ConceptParts.PRE], ast.Expression)
|
||||
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]
|
||||
assert all_props == ["a", "b"]
|
||||
|
||||
assert concept_found.key == "__var__0 + __var__1"
|
||||
assert concept_found.id == "100"
|
||||
|
||||
# def test_i_cannot_add_the_same_concept_twice():
|
||||
# concept1 = DefConceptNode(name="concept")
|
||||
|
||||
Reference in New Issue
Block a user