Lichen

Annotated tests/nested_value_changed.py

2:3dff1f10598f
2016-08-30 Paul Boddie Added tests from PythonLight.
paul@2 1
a = 4
paul@2 2
paul@2 3
def f(x):
paul@2 4
    def g():
paul@2 5
        y = 2 # used to initialise h
paul@2 6
        def h(z):
paul@2 7
            return x, y, z, a
paul@2 8
        y = 5 # Python uses this value directly from g in h
paul@2 9
        return h
paul@2 10
    return g
paul@2 11
paul@2 12
result = f(1)()(3)
paul@2 13
assert result == (1, 2, 3, 4) # (1, 5, 3, 4) in Python