mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-46927: Include the type's name in the error message for subscripting non-generic types (GH-31694)
This commit is contained in:
parent
2031149b9a
commit
ab9301a28f
4 changed files with 8 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue