MCPcopy Index your code
hub / github.com/RustPython/RustPython / test___closure__

Method test___closure__

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
assertIsInstanceMethod · 0.80
cannot_set_attrMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected