summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-05-09 09:53:16 (GMT)
committerGitHub <noreply@github.com>2017-05-09 09:53:16 (GMT)
commitc8a77d339478e9d67c966a0d0def7e69e372fb1c (patch)
tree1f84d98c1b6b1ae5c462773b88939e56c60f1bb7
parent4e7457b85316e6591a4f0c3a4d0807bfdf7a2bea (diff)
downloadcpython-c8a77d339478e9d67c966a0d0def7e69e372fb1c.zip
cpython-c8a77d339478e9d67c966a0d0def7e69e372fb1c.tar.gz
cpython-c8a77d339478e9d67c966a0d0def7e69e372fb1c.tar.bz2
Fix SyntaxWarning on importing test_inspect (#1512)
Fix the following warning when test_inspect.py is compiled to test_inspect.pyc: test_inspect.py:505: SyntaxWarning: tuple parameter unpacking has been removed in 3.x def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): Replace also test.test_support import with test.support.
-rw-r--r--Lib/test/test_inspect.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 3d9c3b1..7d09c6f 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -5,10 +5,11 @@ import unittest
import inspect
import linecache
import datetime
+import textwrap
from UserList import UserList
from UserDict import UserDict
-from test.test_support import run_unittest, check_py3k_warnings, have_unicode
+from test.support import run_unittest, check_py3k_warnings, have_unicode
with check_py3k_warnings(
("tuple parameter unpacking has been removed", SyntaxWarning),
@@ -502,10 +503,15 @@ class TestClassesAndFunctions(unittest.TestCase):
'g', 'h', (3, (4, (5,))),
'(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)')
- def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h):
- def eggs():
- return a + b + c + d + e + f + g + h
- return eggs
+ with check_py3k_warnings(("tuple parameter unpacking has been removed",
+ SyntaxWarning),
+ quiet=True):
+ exec(textwrap.dedent('''
+ def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h):
+ def eggs():
+ return a + b + c + d + e + f + g + h
+ return eggs
+ '''))
self.assertArgSpecEquals(spam_deref,
['a', 'b', 'c', 'd', ['e', ['f']]],
'g', 'h', (3, (4, (5,))),