summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericalias.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_genericalias.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_genericalias.py')
-rw-r--r--Lib/test/test_genericalias.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index ea0dc24..7601cb0 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -236,13 +236,13 @@ class BaseTest(unittest.TestCase):
self.assertEqual(repr(x2), 'tuple[*tuple[int, str]]')
x3 = tuple[*tuple[int, ...]]
self.assertEqual(repr(x3), 'tuple[*tuple[int, ...]]')
- self.assertTrue(repr(MyList[int]).endswith('.BaseTest.test_repr.<locals>.MyList[int]'))
+ self.assertEndsWith(repr(MyList[int]), '.BaseTest.test_repr.<locals>.MyList[int]')
self.assertEqual(repr(list[str]()), '[]') # instances should keep their normal repr
# gh-105488
- self.assertTrue(repr(MyGeneric[int]).endswith('MyGeneric[int]'))
- self.assertTrue(repr(MyGeneric[[]]).endswith('MyGeneric[[]]'))
- self.assertTrue(repr(MyGeneric[[int, str]]).endswith('MyGeneric[[int, str]]'))
+ self.assertEndsWith(repr(MyGeneric[int]), 'MyGeneric[int]')
+ self.assertEndsWith(repr(MyGeneric[[]]), 'MyGeneric[[]]')
+ self.assertEndsWith(repr(MyGeneric[[int, str]]), 'MyGeneric[[int, str]]')
def test_exposed_type(self):
import types
@@ -362,7 +362,7 @@ class BaseTest(unittest.TestCase):
def test_issubclass(self):
class L(list): ...
- self.assertTrue(issubclass(L, list))
+ self.assertIsSubclass(L, list)
with self.assertRaises(TypeError):
issubclass(L, list[str])