summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2025-05-22 10:42:50 (GMT)
committerGitHub <noreply@github.com>2025-05-22 10:42:50 (GMT)
commitdb98e0bb127c469842dc119d23e5daacd23862cc (patch)
tree5628e04625c93f2e5bde25aa29dedb3c154a0dec /Lib/test/test_tempfile.py
parentd5f7e80d4407655919b32bbd5746b23af174bc5b (diff)
downloadcpython-db98e0bb127c469842dc119d23e5daacd23862cc.zip
cpython-db98e0bb127c469842dc119d23e5daacd23862cc.tar.gz
cpython-db98e0bb127c469842dc119d23e5daacd23862cc.tar.bz2
[3.14] gh-71339: Use new assertion methods in tests (GH-129046) (GH-134498)
(cherry picked from commit 2602d8ae981c4bae1cada2c174b367d97f712efb) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index d46d3c0..52b13b9 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -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