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

Method test_classes

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

collectMethod · 0.80
aClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected