

@skipif((sys.version_info < (3,)), reason='no nonlocal on legacy Python')
def test_nonlocal(self):
    assert (py2js('nonlocal foo;foo = 3').strip() == 'foo = 3;')
    func3_code = 'def func3():\n            def inner():\n                nonlocal x\n                x = 3\n            x = 2\n            inner()\n            return x\n        '
    assert (evaljs((py2js(func3_code) + 'func3()')) == '3')

dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_parser2.py TestFunctions.test_nonlocal/original