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

Method test_method_dead

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

Source from the content-addressed store, hash-verified

1201 self.assertIs(r(), None)
1202
1203 def test_method_dead(self):
1204 C = self._subclass()
1205 o = C(1)
1206 r = weakref.WeakMethod(o.some_method)
1207 del C.some_method
1208 gc.collect()
1209 self.assertIs(r(), None)
1210
1211 def test_callback_when_object_dead(self):
1212 # Test callback behaviour when object dies first.

Callers

nothing calls this directly

Calls 5

_subclassMethod · 0.95
CClass · 0.70
rFunction · 0.50
collectMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected