Beispiel #1
0
def test_as_decorator():
	ns = {}
	exec('\n'.join(['def func():'] + ['\t' + x for x in CODE.splitlines() + ['return result']]), ns)
	assert with_goto(ns['func'])() == EXPECTED
Beispiel #2
0
def test_with_code():
	ns = {}
	exec(with_goto(compile(CODE, '', 'exec')), ns)
	assert ns['result'] == EXPECTED