Enhanced ExecutionContext to keep track of the execution flow

This commit is contained in:
2020-01-07 15:47:43 +01:00
parent ffd98d7407
commit b4346b5af0
19 changed files with 966 additions and 190 deletions
+89 -4
View File
@@ -32,8 +32,37 @@ def test_i_can_serialize():
Test concept.to_dict()
:return:
"""
# TODO
pass
concept = Concept(
name="concept_name",
is_builtin=True,
is_unique=True,
key="concept_key",
body="definition of the body",
where="definition of the where",
pre="definition of the pre",
post="definition of the post",
definition="bnf definition",
definition_type="def type",
desc="this this the desc",
id="123456"
).set_prop("a", 10).set_prop("b", None)
to_dict = concept.to_dict()
assert to_dict == {
'body': 'definition of the body',
'definition': 'bnf definition',
'definition_type': 'def type',
'desc': 'this this the desc',
'id': '123456',
'is_builtin': True,
'is_unique': True,
'key': 'concept_key',
'name': 'concept_name',
'post': 'definition of the post',
'pre': 'definition of the pre',
'props': [('a', 10), ('b', None)],
'where': 'definition of the where'
}
def test_i_can_deserialize():
@@ -41,5 +70,61 @@ def test_i_can_deserialize():
Test concept.from_dict()
:return:
"""
# TODO
pass
from_dict = {
'body': 'definition of the body',
'definition': 'bnf definition',
'definition_type': 'def type',
'desc': 'this this the desc',
'id': '123456',
'is_builtin': True,
'is_unique': True,
'key': 'concept_key',
'name': 'concept_name',
'post': 'definition of the post',
'pre': 'definition of the pre',
'props': [('a', 10), ('b', None)],
'where': 'definition of the where'
}
concept = Concept().from_dict(from_dict)
assert concept == Concept(
name="concept_name",
is_builtin=True,
is_unique=True,
key="concept_key",
body="definition of the body",
where="definition of the where",
pre="definition of the pre",
post="definition of the post",
definition="bnf definition",
definition_type="def type",
desc="this this the desc",
id="123456"
).set_prop("a", 10).set_prop("b", None)
def test_i_can_compare_concept_with_circular_reference():
foo = Concept("foo")
foo.metadata.body = foo
assert foo == foo
def test_i_can_compare_concept_with_sophisticated_circular_reference():
foo = Concept("foo")
bar = Concept("foo", body=foo)
baz = Concept("foo", body=bar)
foo.metadata.body = baz
assert foo != bar
def test_i_can_compare_concept_with_sophisticated_circular_reference_in_other_metadata():
foo = Concept("foo")
bar = Concept("foo", pre=foo)
baz = Concept("foo", pre=bar)
foo.metadata.pre = baz
assert foo != bar