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

Method test_classes

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

Source from the content-addressed store, hash-verified

887 gc.collect()
888
889 def test_classes(self):
890 # Check that classes are weakrefable.
891 class A(object):
892 pass
893 l = []
894 weakref.ref(int)
895 a = weakref.ref(A, l.append)
896 A = None
897 gc.collect()
898 self.assertEqual(a(), None)
899 self.assertEqual(l, [a])
900
901 def test_equality(self):
902 # Alive weakrefs defer equality testing to their underlying object.

Callers

nothing calls this directly

Calls 3

aClass · 0.70
collectMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected