Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Lib/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,10 @@ class BytesTest(BaseBytesTest, unittest.TestCase):
type2test = bytes

def test_getitem_error(self):
b = b'python'
msg = "byte indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
b'python'['a']
b['a']

def test_buffer_is_readonly(self):
fd = os.open(__file__, os.O_RDONLY)
Expand Down Expand Up @@ -1040,14 +1041,15 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
type2test = bytearray

def test_getitem_error(self):
b = bytearray(b'python')
msg = "bytearray indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
bytearray(b'python')['a']
b['a']

def test_setitem_error(self):
b = bytearray(b'python')
msg = "bytearray indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
b = bytearray(b'python')
b['a'] = "python"

def test_nohash(self):
Expand Down
5 changes: 3 additions & 2 deletions Lib/test/test_extcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@
...
TypeError: dir() argument after * must be an iterable, not function

>>> None(*h)
>>> nothing = None
>>> nothing(*h)
Traceback (most recent call last):
...
TypeError: NoneType object argument after * must be an iterable, \
Expand Down Expand Up @@ -305,7 +306,7 @@
...
TypeError: dir() argument after ** must be a mapping, not function

>>> None(**h)
>>> nothing(**h)
Traceback (most recent call last):
...
TypeError: NoneType object argument after ** must be a mapping, \
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class TupleTest(seq_tests.CommonTest):
type2test = tuple

def test_getitem_error(self):
t = ()
msg = "tuple indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
()['a']
t['a']

def test_constructors(self):
super().test_constructors()
Expand Down