Enhanced ExecutionContext to keep track of the execution flow
This commit is contained in:
+63
-8
@@ -201,10 +201,10 @@ def test_i_can_get_list_of_concept_when_same_key_when_no_cache():
|
||||
|
||||
sheerka.concepts_cache = {} # reset the cache
|
||||
|
||||
from_cache = sheerka.get(concept1.key)
|
||||
assert len(from_cache) == 2
|
||||
assert from_cache[0] == concept1
|
||||
assert from_cache[1] == concept2
|
||||
result = sheerka.get(concept1.key)
|
||||
assert len(result) == 2
|
||||
assert result[0] == concept1
|
||||
assert result[1] == concept2
|
||||
|
||||
|
||||
def test_i_can_get_list_of_concept_when_same_key_when_cache():
|
||||
@@ -220,10 +220,65 @@ def test_i_can_get_list_of_concept_when_same_key_when_cache():
|
||||
|
||||
# sheerka.concepts_cache = {} # Do not reset the cache
|
||||
|
||||
from_cache = sheerka.get(concept1.key)
|
||||
assert len(from_cache) == 2
|
||||
assert from_cache[0] == concept1
|
||||
assert from_cache[1] == concept2
|
||||
result = sheerka.get(concept1.key)
|
||||
assert len(result) == 2
|
||||
assert result[0] == concept1
|
||||
assert result[1] == concept2
|
||||
|
||||
|
||||
def test_i_can_get_the_correct_concept_using_the_id_when_same_key_when_no_cache():
|
||||
sheerka = get_sheerka()
|
||||
concept1 = get_default_concept()
|
||||
concept2 = get_default_concept()
|
||||
concept2.metadata.body = "a+b"
|
||||
|
||||
res1 = sheerka.create_new_concept(get_context(sheerka), concept1)
|
||||
res2 = sheerka.create_new_concept(get_context(sheerka), concept2)
|
||||
|
||||
assert res1.value.body.key == res2.value.body.key # same key
|
||||
|
||||
result = sheerka.get(concept1.key, res2.body.body.id)
|
||||
assert result.name == "a + b"
|
||||
assert result.body == "a+b"
|
||||
|
||||
|
||||
def test_i_can_get_the_correct_concept_using_the_id__when_same_key_when_cache():
|
||||
sheerka = get_sheerka()
|
||||
concept1 = get_default_concept()
|
||||
concept2 = get_default_concept()
|
||||
concept2.metadata.body = "a+b"
|
||||
|
||||
res1 = sheerka.create_new_concept(get_context(sheerka), concept1)
|
||||
res2 = sheerka.create_new_concept(get_context(sheerka), concept2)
|
||||
|
||||
assert res1.value.body.key == res2.value.body.key # same key
|
||||
|
||||
result = sheerka.get(concept1.key, res2.body.body.id)
|
||||
assert result.name == "a + b"
|
||||
assert result.body == "a+b"
|
||||
|
||||
|
||||
def test_i_cannot_get_the_correct_concept_id_the_id_is_wrong():
|
||||
sheerka = get_sheerka()
|
||||
concept1 = get_default_concept()
|
||||
concept2 = get_default_concept()
|
||||
concept2.metadata.body = "a+b"
|
||||
|
||||
res1 = sheerka.create_new_concept(get_context(sheerka), concept1)
|
||||
res2 = sheerka.create_new_concept(get_context(sheerka), concept2)
|
||||
|
||||
assert res1.value.body.key == res2.value.body.key # same key
|
||||
|
||||
result = sheerka.get(concept1.key, "wrong id")
|
||||
assert sheerka.isinstance(result, BuiltinConcepts.UNKNOWN_CONCEPT)
|
||||
|
||||
|
||||
def test_i_cannot_get_when_key_is_none():
|
||||
sheerka = get_sheerka()
|
||||
|
||||
res = sheerka.get(None)
|
||||
assert sheerka.isinstance(res, BuiltinConcepts.ERROR)
|
||||
assert res.body == "Concept key is undefined."
|
||||
|
||||
|
||||
def test_unknown_concept_is_return_when_the_concept_is_not_found():
|
||||
|
||||
Reference in New Issue
Block a user