mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +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
|
@ -9,6 +9,7 @@ import unittest
|
|||
|
||||
from test.support import threading_helper
|
||||
from test.test_importlib import util as test_util
|
||||
from test.support.testcase import ExtraAssertions
|
||||
|
||||
|
||||
class CollectInit:
|
||||
|
@ -58,7 +59,7 @@ class TestingImporter(abc.MetaPathFinder, abc.Loader):
|
|||
self.load_count += 1
|
||||
|
||||
|
||||
class LazyLoaderTests(unittest.TestCase):
|
||||
class LazyLoaderTests(unittest.TestCase, ExtraAssertions):
|
||||
|
||||
def test_init(self):
|
||||
with self.assertRaises(TypeError):
|
||||
|
@ -125,12 +126,12 @@ class LazyLoaderTests(unittest.TestCase):
|
|||
# Deleting an attribute should stay deleted.
|
||||
module = self.new_module()
|
||||
del module.attr
|
||||
self.assertFalse(hasattr(module, 'attr'))
|
||||
self.assertNotHasAttr(module, 'attr')
|
||||
|
||||
def test_delete_preexisting_attr(self):
|
||||
module = self.new_module()
|
||||
del module.__name__
|
||||
self.assertFalse(hasattr(module, '__name__'))
|
||||
self.assertNotHasAttr(module, '__name__')
|
||||
|
||||
def test_module_substitution_error(self):
|
||||
with test_util.uncache(TestingImporter.module_name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue