diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_weakref.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index a909428..8b5bbc3 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -680,6 +680,18 @@ class ReferencesTestCase(TestBase): # No exception should be raised here gc.collect() + def test_classes(self): + # Check that classes are weakrefable. + class A(object): + pass + l = [] + weakref.ref(int) + a = weakref.ref(A, l.append) + A = None + gc.collect() + self.assertEqual(a(), None) + self.assertEqual(l, [a]) + class SubclassableWeakrefTestCase(TestBase): |