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)
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):
...
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, \
...
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, \
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()