Skip to content

Commit 6e2183f

Browse files
committed
Revise the test for clarity and traceability.
1 parent ee94f7c commit 6e2183f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

importlib_resources/tests/test_resource.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,17 @@ class ResourceFromNamespaceZipTests(
220220
MODULE = 'namespacedata01'
221221

222222

223-
class ResourceFromMainModuleWithNoneSpecTests(unittest.TestCase):
224-
# `__main__.__spec__` can be `None` depending on how it is populated.
225-
# https://docs.python.org/3/reference/import.html#main-spec
223+
class MainModuleTests(unittest.TestCase):
226224
def test_main_module_with_none_spec(self):
225+
"""
226+
__main__ module with no spec should raise TypeError (for clarity).
227+
228+
See python/cpython#138531 for details.
229+
"""
230+
# construct a __main__ module with no __spec__.
227231
mainmodule = types.ModuleType("__main__")
228232

229-
self.assertIsNone(mainmodule.__spec__)
233+
assert mainmodule.__spec__ is None
230234

231235
with self.assertRaises(
232236
TypeError,

0 commit comments

Comments
 (0)