Skip to content

Commit 3754cb8

Browse files
committed
add module dealloc test
1 parent a5e44c9 commit 3754cb8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_weakref.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import copy
1010
import threading
1111
import time
12+
import types
1213
import random
1314
import textwrap
1415

@@ -2252,6 +2253,13 @@ def test_names(self):
22522253
self.assertEqual(obj.__name__, name)
22532254
self.assertEqual(obj.__qualname__, name)
22542255

2256+
def test_module_dealloc(self):
2257+
mod = types.ModuleType("temp_mod")
2258+
r = weakref.ref(mod)
2259+
self.assertIsNotNone(r, "weak ref to a module should not be None")
2260+
2261+
del mod
2262+
22552263

22562264
libreftest = """ Doctest for examples in the library reference: weakref.rst
22572265

0 commit comments

Comments
 (0)