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

Method test_alive

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

Source from the content-addressed store, hash-verified

1185 return C
1186
1187 def test_alive(self):
1188 o = Object(1)
1189 r = weakref.WeakMethod(o.some_method)
1190 self.assertIsInstance(r, weakref.ReferenceType)
1191 self.assertIsInstance(r(), type(o.some_method))
1192 self.assertIs(r().__self__, o)
1193 self.assertIs(r().__func__, o.some_method.__func__)
1194 self.assertEqual(r()(), 4)
1195
1196 def test_object_dead(self):
1197 o = Object(1)

Callers

nothing calls this directly

Calls 5

assertIsInstanceMethod · 0.80
ObjectClass · 0.70
rFunction · 0.50
assertIsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected