mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-71339: Use new assertion methods in test_import and test_importlib (GH-129052)
This commit is contained in:
parent
da310d209a
commit
f7cc7d296c
18 changed files with 51 additions and 54 deletions
|
@ -430,8 +430,7 @@ class StartupTests:
|
|||
for name, module in sys.modules.items():
|
||||
if isinstance(module, types.ModuleType):
|
||||
with self.subTest(name=name):
|
||||
self.assertTrue(hasattr(module, '__loader__'),
|
||||
'{!r} lacks a __loader__ attribute'.format(name))
|
||||
self.assertHasAttr(module, '__loader__')
|
||||
if self.machinery.BuiltinImporter.find_spec(name):
|
||||
self.assertIsNot(module.__loader__, None)
|
||||
elif self.machinery.FrozenImporter.find_spec(name):
|
||||
|
@ -441,7 +440,7 @@ class StartupTests:
|
|||
for name, module in sys.modules.items():
|
||||
if isinstance(module, types.ModuleType):
|
||||
with self.subTest(name=name):
|
||||
self.assertTrue(hasattr(module, '__spec__'))
|
||||
self.assertHasAttr(module, '__spec__')
|
||||
if self.machinery.BuiltinImporter.find_spec(name):
|
||||
self.assertIsNot(module.__spec__, None)
|
||||
elif self.machinery.FrozenImporter.find_spec(name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue