summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-02-19 11:49:09 (GMT)
committerGitHub <noreply@github.com>2019-02-19 11:49:09 (GMT)
commit8e79e6e56f516385ccb761e407dfff3a39253180 (patch)
tree288fe0464276f9f8efb96556c1dee35766e3a089 /Lib
parente7a4bb554edb72fc6619d23241d59162d06f249a (diff)
downloadcpython-8e79e6e56f516385ccb761e407dfff3a39253180.zip
cpython-8e79e6e56f516385ccb761e407dfff3a39253180.tar.gz
cpython-8e79e6e56f516385ccb761e407dfff3a39253180.tar.bz2
Fix syntax warnings in tests introduced in bpo-15248. (GH-11932)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_bytes.py8
-rw-r--r--Lib/test/test_extcall.py5
-rw-r--r--Lib/test/test_tuple.py3
3 files changed, 10 insertions, 6 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index f7454d9..a091360 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -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):
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index a3ff441..3cac3bd 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -264,7 +264,8 @@ What about willful misconduct?
...
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, \
@@ -305,7 +306,7 @@ not function
...
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, \
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index ca46d0b..d2a2ed3 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -19,9 +19,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()