mirror of
https://github.com/python/cpython.git
synced 2025-11-08 09:32:01 +00:00
[3.13] gh-71339: Use new assertion methods in test_import and test_importlib (GH-129052) (#129123)
(cherry picked from commit f7cc7d296c)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
d2ec87f740
commit
a9bb0092d0
19 changed files with 68 additions and 64 deletions
|
|
@ -430,8 +430,7 @@ def test_everyone_has___loader__(self):
|
|||
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 @@ def test_everyone_has___spec__(self):
|
|||
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