diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-11-19 22:54:57 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-11-19 22:54:57 (GMT) |
commit | 99a5023c80d9a690e4305e2ded1b2a9cf6b30251 (patch) | |
tree | 3fb07d09a0ba874e6607b11b1ad9cc55515c1daa /Lib/test/test_syntax.py | |
parent | b678de8ba643d940009f26d50d3f6014305f152c (diff) | |
download | cpython-99a5023c80d9a690e4305e2ded1b2a9cf6b30251.zip cpython-99a5023c80d9a690e4305e2ded1b2a9cf6b30251.tar.gz cpython-99a5023c80d9a690e4305e2ded1b2a9cf6b30251.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 26d78ad..2118c62 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -493,10 +493,14 @@ class SyntaxTestCase(unittest.TestCase): self.fail("SyntaxError is not a %s" % subclass.__name__) mo = re.search(errtext, str(err)) if mo is None: - self.fail("SyntaxError did not contain '%r'" % (errtext,)) + self.fail("%s did not contain '%r'" % (err, errtext,)) else: self.fail("compile() did not raise SyntaxError") + def test_paren_arg_with_default(self): + self._check_error("def f((x)=23): pass", + "parenthesized arg with default") + def test_assign_call(self): self._check_error("f() = 1", "assign") |