MCPcopy Index your code
hub / github.com/python/cpython / testMixedFreevarsAndCellvars

Method testMixedFreevarsAndCellvars

Lib/test/test_scope.py:112–130  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

110 self.assertEqual(test_func(5), 47)
111
112 def testMixedFreevarsAndCellvars(self):
113
114 def identity(x):
115 return x
116
117 def f(x, y, z):
118 def g(a, b, c):
119 a = a + x # 3
120 def h():
121 # z * (4 + 9)
122 # 3 * 13
123 return identity(z * (b + y))
124 y = c + z # 9
125 return h
126 return g
127
128 g = f(1, 2, 3)
129 h = g(2, 4, 6)
130 self.assertEqual(h(), 39)
131
132 def testFreeVarInMethod(self):
133

Callers

nothing calls this directly

Calls 4

fFunction · 0.70
gFunction · 0.70
hClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected