mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
Merged revisions 76416-76417 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76416 | benjamin.peterson | 2009-11-19 16:54:57 -0600 (Thu, 19 Nov 2009) | 10 lines improve several corner cases related with argument names in parenthesis - Fix #7362: give a good error message for parenthesized arguments with defaults. - Add a py3k warning for any parenthesized arguments since those are not allowed in Py3. This warning is not given in tuple unpacking, since that incurs the tuple unpacking warning. ........ r76417 | benjamin.peterson | 2009-11-19 16:58:01 -0600 (Thu, 19 Nov 2009) | 1 line add news notes for r76416 ........
This commit is contained in:
parent
aa4af333ec
commit
440847cf8e
4 changed files with 37 additions and 2 deletions
|
@ -31,6 +31,18 @@ class TestPy3KWarnings(unittest.TestCase):
|
|||
exec "`2`" in {}
|
||||
self.assertWarning(None, w, expected)
|
||||
|
||||
def test_paren_arg_names(self):
|
||||
expected = 'parenthesized argument names are invalid in 3.x'
|
||||
def check(s):
|
||||
exec s in {}
|
||||
self.assertWarning(None, w, expected)
|
||||
with check_warnings() as w:
|
||||
check("def f((x)): pass")
|
||||
check("def f((((x))), (y)): pass")
|
||||
check("def f((x), (((y))), m=32): pass")
|
||||
# Something like def f((a, (b))): pass will raise the tuple
|
||||
# unpacking warning.
|
||||
|
||||
def test_bool_assign(self):
|
||||
# So we don't screw up our globals
|
||||
def safe_exec(expr):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue