Files
Sheerka-Old/tests/test_ExecutionContext.py
T

44 lines
1.3 KiB
Python

from core.builtin_concepts import BuiltinConcepts
from core.concept import Concept
from core.sheerka import ExecutionContext
from sdp.sheerkaDataProvider import Event
def test_id_is_incremented_by_event_digest():
a = ExecutionContext("foo", Event("event_1"), None)
b = ExecutionContext("foo", Event("event_1"), None)
c = ExecutionContext("foo", Event("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("event_1"), "fake_sheerka",
desc="some description",
obj=Concept("foo"),
step=BuiltinConcepts.EVALUATION,
iteration=15,
concepts={"bar": Concept("bar")})
a.preprocess = set()
a.preprocess.add("preprocess")
b = a.push()
assert b.who == a.who
assert b.event == a.event
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 + " "
assert b.preprocess == a.preprocess