First implementation of questions management

This commit is contained in:
2020-08-14 08:16:33 +02:00
parent e84b394da2
commit 351c16f946
47 changed files with 1582 additions and 400 deletions
+10 -10
View File
@@ -35,7 +35,7 @@ def test_i_can_push():
concepts={"bar": Concept("bar")})
a.preprocess = set()
a.preprocess.add("preprocess")
a.local_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
a.protected_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
a.global_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
b = a.push(BuiltinConcepts.EVALUATION, "sub action context", desc="sub description")
@@ -54,7 +54,7 @@ def test_i_can_push():
assert b.id == a.id + 1
assert b._tab == a._tab + " "
assert b.preprocess == a.preprocess
assert b.local_hints == {BuiltinConcepts.EVAL_BODY_REQUESTED}
assert b.protected_hints == {BuiltinConcepts.EVAL_BODY_REQUESTED}
assert b.global_hints == a.global_hints
@@ -64,10 +64,10 @@ def test_children_i_created_when_i_push():
e.push(BuiltinConcepts.NOP, None, who="b", desc="oups! I did a again")
e.push(BuiltinConcepts.NOP, None, who="c", desc="I do something else")
assert len(e.children) == 3
assert e.children[0].who, e.children[0].who == ("a", "I do something")
assert e.children[1].who, e.children[1].who == ("b", "oups! I did a again")
assert e.children[2].who, e.children[2].who == ("c", "I do something else")
assert len(e._children) == 3
assert e._children[0].who, e._children[0].who == ("a", "I do something")
assert e._children[1].who, e._children[1].who == ("b", "oups! I did a again")
assert e._children[2].who, e._children[2].who == ("c", "I do something else")
def test_i_can_add_variable_when_i_push():
@@ -81,17 +81,17 @@ def test_i_can_add_variable_when_i_push():
def test_local_hints_are_local_and_global_hints_are_global():
a = ExecutionContext("foo", Event("event_1"), "fake_sheerka", BuiltinConcepts.NOP, None)
a.local_hints.add("local hint 1")
a.protected_hints.add("local hint 1")
a.global_hints.add("global hint 1")
b = a.push(BuiltinConcepts.NOP, None)
b.local_hints.add("local hint 2")
b.protected_hints.add("local hint 2")
b.global_hints.add("global hint 2")
assert a.local_hints == {"local hint 1"}
assert a.protected_hints == {"local hint 1"}
assert a.global_hints == {"global hint 1", "global hint 2"}
assert b.local_hints == {"local hint 1", "local hint 2"}
assert b.protected_hints == {"local hint 1", "local hint 2"}
assert b.global_hints == {"global hint 1", "global hint 2"}