Closed hugobowne closed 7 years ago
The problem was that for the for_iter
test in test_for_loop()
, the context_vals
for inside the for loop were already used, i.e. key
and value
. This was not wanted, because when defining the sequence over which to iterate, you're still in 'another context'.
I've coded a fix, after which the following SCT will work:
def inner_test():
test_function("print", index=1)
def iter_test():
context=[{'name':"luke", 'affiliation':"jedi", 'status':"missing"}]
test_expression_result(context_vals = context)
def body_test():
context=['name', 'luke']
test_expression_output(context_vals = context)
test_for_loop(for_iter = iter_test, body = body_test)
test_function("print", index=2)
# Test: report_status() definition
test_function_definition(
"report_status", body=inner_test,
outputs = [{'args': [], 'kwargs': {'name':"hugo", 'affiliation':"datacamp"}}])
I'll close this issue as soon as the fix is deployed (will do asap).
thx!
ETA? :-D
before the end of today, @machow is handling it. @machow, can you close as soon as it's live?
it's live.
works! thx @machow & @filipsch
I am trying to write an SCT for the solution code below (see my SCT attempt below it).
I cannot figure out how to
test_for_loop()
within thistest_function_definition()
. Probably related to my not understandingtest_expression_result()
see #91. But also because I am having problems withextra_env
andcontext_vals
with**kwargs
here (I think!).*\ =sct