mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #22077: Improve index error messages for bytearrays, bytes, lists, and
tuples by adding 'or slices'. Added ', not <typename' for bytearrays. Original patch by Claudiu Popa.
This commit is contained in:
parent
7f9cc9359b
commit
ffff1440d1
8 changed files with 45 additions and 6 deletions
|
@ -6,6 +6,11 @@ import pickle
|
|||
class TupleTest(seq_tests.CommonTest):
|
||||
type2test = tuple
|
||||
|
||||
def test_getitem_error(self):
|
||||
msg = "tuple indices must be integers or slices"
|
||||
with self.assertRaisesRegex(TypeError, msg):
|
||||
()['a']
|
||||
|
||||
def test_constructors(self):
|
||||
super().test_constructors()
|
||||
# calling built-in types without argument must return empty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue