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

Method testNearestEnclosingScope

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

Source from the content-addressed store, hash-verified

97 self.assertEqual(plus10(-2), 8)
98
99 def testNearestEnclosingScope(self):
100
101 def f(x):
102 def g(y):
103 x = 42 # check that this masks binding in f()
104 def h(z):
105 return x + z
106 return h
107 return g(2)
108
109 test_func = f(10)
110 self.assertEqual(test_func(5), 47)
111
112 def testMixedFreevarsAndCellvars(self):
113

Callers

nothing calls this directly

Calls 3

fFunction · 0.70
test_funcClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected