diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2012-04-29 17:35:56 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2012-04-29 17:35:56 (GMT) |
commit | b63fd2a4084c99178f5218abc387d6b9bfdf25bc (patch) | |
tree | 72b2d1c3e33aa0985349beb3155924a52b380eba /Lib/test/test_parser.py | |
parent | 119d026bf64a6bc1e8e4a2311dcab2d830d089c6 (diff) | |
parent | ea7e9f9a83a88325e599d0a7b31122e50495a5aa (diff) | |
download | cpython-b63fd2a4084c99178f5218abc387d6b9bfdf25bc.zip cpython-b63fd2a4084c99178f5218abc387d6b9bfdf25bc.tar.gz cpython-b63fd2a4084c99178f5218abc387d6b9bfdf25bc.tar.bz2 |
Issue #9154: Merge fix from 3.2.
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r-- | Lib/test/test_parser.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index b6f81fb..d13cf2b 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -150,6 +150,27 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase): self.check_suite("@funcattrs()\n" "def f(): pass") + # keyword-only arguments + self.check_suite("def f(*, a): pass") + self.check_suite("def f(*, a = 5): pass") + self.check_suite("def f(*, a = 5, b): pass") + self.check_suite("def f(*, a, b = 5): pass") + self.check_suite("def f(*, a, b = 5, **kwds): pass") + self.check_suite("def f(*args, a): pass") + self.check_suite("def f(*args, a = 5): pass") + self.check_suite("def f(*args, a = 5, b): pass") + self.check_suite("def f(*args, a, b = 5): pass") + self.check_suite("def f(*args, a, b = 5, **kwds): pass") + + # function annotations + self.check_suite("def f(a: int): pass") + self.check_suite("def f(a: int = 5): pass") + self.check_suite("def f(*args: list): pass") + self.check_suite("def f(**kwds: dict): pass") + self.check_suite("def f(*, a: int): pass") + self.check_suite("def f(*, a: int = 5): pass") + self.check_suite("def f() -> int: pass") + def test_class_defs(self): self.check_suite("class foo():pass") self.check_suite("class foo(object):pass") |