Closed hugobowne closed 7 years ago
For some obscure reason that I can't explain myself, you have to put the import collection
call inside the definition of inner_test()
. It's probably a scoping issue, but I can't tell you what's really playing here.
inner_test()
should look like this:
def inner_test():
def inner_inner_test():
test_object_after_expression("echo_word", extra_env={'word1' : 'hithere', 'echo': 2})
import collections
handlers = collections.OrderedDict()
handlers['all'] = lambda: test_function('print')
test_try_except(index = 1,
body = inner_inner_test,
handlers = handlers)
works great thx good nice!
I'm trying to use
test_try_except()
withintest_function_definition()
.I am using this as a model: https://github.com/datacamp/pythonwhat/wiki/test_try_except
No luck yet!
It seems to tell me 'name collections is not defined' :
SCT is here, Ch3 line618: https://www.datacamp.com/teach/edit/repositories/463/branches/SCT_edits
You get (10**100000)! points for using
collections
, one of my favourite python modules, if not my favourite 👍