mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix syntax warnings in tests introduced in bpo-15248. (GH-11932)
This commit is contained in:
parent
e7a4bb554e
commit
8e79e6e56f
3 changed files with 10 additions and 6 deletions
|
@ -852,9 +852,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)
|
||||
|
@ -1042,14 +1043,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue