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

Method test___closure__

Lib/test/test_funcattrs.py:137–145  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

135 self.assertNotIn('__builtins__', ns['func4'].__globals__)
136
137 def test___closure__(self):
138 a = 12
139 def f(): print(a)
140 c = f.__closure__
141 self.assertIsInstance(c, tuple)
142 self.assertEqual(len(c), 1)
143 # don't have a type object handy
144 self.assertEqual(c[0].__class__.__name__, "cell")
145 self.cannot_set_attr(f, "__closure__", c, AttributeError)
146
147 def test_cell_new(self):
148 cell_obj = types.CellType(1)

Callers

nothing calls this directly

Calls 3

assertIsInstanceMethod · 0.80
cannot_set_attrMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected