Concept validation must be requested

This commit is contained in:
2020-03-09 12:23:53 +01:00
parent ef31a4807d
commit 1bde97b5e3
27 changed files with 346 additions and 280 deletions
+30 -2
View File
@@ -34,7 +34,8 @@ def test_i_can_push():
concepts={"bar": Concept("bar")})
a.preprocess = set()
a.preprocess.add("preprocess")
a.extra_info.append(BuiltinConcepts.CONCEPT_EVAL_REQUESTED)
a.local_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
a.global_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
b = a.push()
@@ -50,7 +51,8 @@ def test_i_can_push():
assert b.id == a.id + 1
assert b._tab == a._tab + " "
assert b.preprocess == a.preprocess
assert b.extra_info == [BuiltinConcepts.CONCEPT_EVAL_REQUESTED]
assert b.local_hints == {BuiltinConcepts.EVAL_BODY_REQUESTED}
assert b.global_hints == a.global_hints
def test_children_i_created_when_i_push():
@@ -72,3 +74,29 @@ def test_i_can_add_variable_when_i_push():
assert sub_e.my_new_var == "new var value"
with pytest.raises(AttributeError):
assert e.my_new_var == "" # my_new_var does not exist in parent
def test_local_hints_are_local_and_global_hints_are_global():
a = ExecutionContext("foo", Event("event_1"), "fake_sheerka")
a.local_hints.add("local hint 1")
a.global_hints.add("global hint 1")
b = a.push()
b.local_hints.add("local hint 2")
b.global_hints.add("global hint 2")
assert a.local_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.global_hints == {"global hint 1", "global hint 2"}
def test_global_hits_are_global_even_when_empty():
a = ExecutionContext("foo", Event("event_1"), "fake_sheerka")
b = a.push()
b.global_hints.add("global hint 2")
assert a.global_hints == {"global hint 2"}
assert b.global_hints == {"global hint 2"}