summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericalias.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-03-05 13:59:24 (GMT)
committerGitHub <noreply@github.com>2022-03-05 13:59:24 (GMT)
commitab9301a28fa431d7a32163126fc96de3b2ce6107 (patch)
tree940f6d0813671a006052b334e0f836e61f97a78e /Lib/test/test_genericalias.py
parent2031149b9a7dfab5f5bad63f417e19f4fc2b9661 (diff)
downloadcpython-ab9301a28fa431d7a32163126fc96de3b2ce6107.zip
cpython-ab9301a28fa431d7a32163126fc96de3b2ce6107.tar.gz
cpython-ab9301a28fa431d7a32163126fc96de3b2ce6107.tar.bz2
bpo-46927: Include the type's name in the error message for subscripting non-generic types (GH-31694)
Diffstat (limited to 'Lib/test/test_genericalias.py')
-rw-r--r--Lib/test/test_genericalias.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index d311281..1407657 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -109,7 +109,7 @@ class BaseTest(unittest.TestCase):
for t in int, str, float, Sized, Hashable:
tname = t.__name__
with self.subTest(f"Testing {tname}"):
- with self.assertRaises(TypeError):
+ with self.assertRaisesRegex(TypeError, tname):
t[int]
def test_instantiate(self):
@@ -275,7 +275,7 @@ class BaseTest(unittest.TestCase):
def test_type_subclass_generic(self):
class MyType(type):
pass
- with self.assertRaises(TypeError):
+ with self.assertRaisesRegex(TypeError, 'MyType'):
MyType[int]
def test_pickle(self):