summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_api.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2025-01-21 09:24:19 (GMT)
committerGitHub <noreply@github.com>2025-01-21 09:24:19 (GMT)
commitf7cc7d296c2cbb33d3f0bde4ace82e8569f7dbc3 (patch)
tree2e06ecfe304200243f327747d528c5bbbd7b7f2d /Lib/test/test_importlib/test_api.py
parentda310d209a6af45e5e1ea48a873f1d14be471a09 (diff)
downloadcpython-f7cc7d296c2cbb33d3f0bde4ace82e8569f7dbc3.zip
cpython-f7cc7d296c2cbb33d3f0bde4ace82e8569f7dbc3.tar.gz
cpython-f7cc7d296c2cbb33d3f0bde4ace82e8569f7dbc3.tar.bz2
gh-71339: Use new assertion methods in test_import and test_importlib (GH-129052)
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r--Lib/test/test_importlib/test_api.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 6035b2c..1bc531a 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -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):