mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498)
(cherry picked from commit 2602d8ae98
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
d5f7e80d44
commit
db98e0bb12
117 changed files with 407 additions and 445 deletions
|
@ -516,11 +516,11 @@ class TestMkstempInner(TestBadTempdir, BaseTestCase):
|
|||
_mock_candidate_names('aaa', 'aaa', 'bbb'):
|
||||
(fd1, name1) = self.make_temp()
|
||||
os.close(fd1)
|
||||
self.assertTrue(name1.endswith('aaa'))
|
||||
self.assertEndsWith(name1, 'aaa')
|
||||
|
||||
(fd2, name2) = self.make_temp()
|
||||
os.close(fd2)
|
||||
self.assertTrue(name2.endswith('bbb'))
|
||||
self.assertEndsWith(name2, 'bbb')
|
||||
|
||||
def test_collision_with_existing_directory(self):
|
||||
# _mkstemp_inner tries another name when a directory with
|
||||
|
@ -528,11 +528,11 @@ class TestMkstempInner(TestBadTempdir, BaseTestCase):
|
|||
with _inside_empty_temp_dir(), \
|
||||
_mock_candidate_names('aaa', 'aaa', 'bbb'):
|
||||
dir = tempfile.mkdtemp()
|
||||
self.assertTrue(dir.endswith('aaa'))
|
||||
self.assertEndsWith(dir, 'aaa')
|
||||
|
||||
(fd, name) = self.make_temp()
|
||||
os.close(fd)
|
||||
self.assertTrue(name.endswith('bbb'))
|
||||
self.assertEndsWith(name, 'bbb')
|
||||
|
||||
|
||||
class TestGetTempPrefix(BaseTestCase):
|
||||
|
@ -828,9 +828,9 @@ class TestMkdtemp(TestBadTempdir, BaseTestCase):
|
|||
_mock_candidate_names('aaa', 'aaa', 'bbb'):
|
||||
file = tempfile.NamedTemporaryFile(delete=False)
|
||||
file.close()
|
||||
self.assertTrue(file.name.endswith('aaa'))
|
||||
self.assertEndsWith(file.name, 'aaa')
|
||||
dir = tempfile.mkdtemp()
|
||||
self.assertTrue(dir.endswith('bbb'))
|
||||
self.assertEndsWith(dir, 'bbb')
|
||||
|
||||
def test_collision_with_existing_directory(self):
|
||||
# mkdtemp tries another name when a directory with
|
||||
|
@ -838,9 +838,9 @@ class TestMkdtemp(TestBadTempdir, BaseTestCase):
|
|||
with _inside_empty_temp_dir(), \
|
||||
_mock_candidate_names('aaa', 'aaa', 'bbb'):
|
||||
dir1 = tempfile.mkdtemp()
|
||||
self.assertTrue(dir1.endswith('aaa'))
|
||||
self.assertEndsWith(dir1, 'aaa')
|
||||
dir2 = tempfile.mkdtemp()
|
||||
self.assertTrue(dir2.endswith('bbb'))
|
||||
self.assertEndsWith(dir2, 'bbb')
|
||||
|
||||
def test_for_tempdir_is_bytes_issue40701_api_warts(self):
|
||||
orig_tempdir = tempfile.tempdir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue