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

Method test_object_dead

Lib/test/test_weakref.py:1196–1201  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1194 self.assertEqual(r()(), 4)
1195
1196 def test_object_dead(self):
1197 o = Object(1)
1198 r = weakref.WeakMethod(o.some_method)
1199 del o
1200 gc.collect()
1201 self.assertIs(r(), None)
1202
1203 def test_method_dead(self):
1204 C = self._subclass()

Callers

nothing calls this directly

Calls 4

ObjectClass · 0.70
rFunction · 0.50
collectMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected