40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
from core.builtin_concepts import BuiltinConcepts
|
|
from core.concept import Concept
|
|
from core.sheerka import ExecutionContext
|
|
|
|
|
|
def test_id_is_incremented_by_event_digest():
|
|
a = ExecutionContext("foo", "event_1", None)
|
|
b = ExecutionContext("foo", "event_1", None)
|
|
c = ExecutionContext("foo", "event_2", None)
|
|
d = b.push()
|
|
e = c.push()
|
|
|
|
assert a.id == 0
|
|
assert b.id == 1
|
|
assert c.id == 0
|
|
assert d.id == 2
|
|
assert e.id == 1
|
|
|
|
|
|
def test_some_properties_are_given_to_the_child():
|
|
a = ExecutionContext("foo", "event_1", "fake_sheerka",
|
|
desc="some description",
|
|
obj=Concept("foo"),
|
|
step=BuiltinConcepts.EVALUATION,
|
|
iteration=15,
|
|
concepts={"bar": Concept("bar")})
|
|
|
|
b = a.push()
|
|
|
|
assert b.who == a.who
|
|
assert b.event_digest == a.event_digest
|
|
assert b.sheerka == a.sheerka
|
|
assert b.desc == ""
|
|
assert b.obj == a.obj
|
|
assert b.step == a.step
|
|
assert b.iteration == a.iteration
|
|
assert b.concepts == a.concepts
|
|
assert b.id == a.id + 1
|
|
assert b._tab == a._tab + " "
|