summaryrefslogtreecommitdiff
path: root/Lib/test/test_future.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-09-30 21:07:05 +0300
committerGitHub <noreply@github.com>2018-09-30 21:07:05 +0300
commit2a2940e5c3e6d92f4fac5e9d361a1e224bb2f12e (patch)
treef703ecf4a37603fcc39e4d30bbec30c0f262e3f0 /Lib/test/test_future.py
parentd5bd036138881bb90a803397d992870a46fbdc2d (diff)
downloadcpython-git-2a2940e5c3e6d92f4fac5e9d361a1e224bb2f12e.tar.gz
bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645)
* Compiling a string annotation containing a lambda with keyword-only argument without default value caused a crash. * Remove the final "*" (it is incorrect syntax) in the representation of lambda without *args and keyword-only arguments when compile from AST. * Improve the representation of lambda without arguments.
Diffstat (limited to 'Lib/test/test_future.py')
-rw-r--r--Lib/test/test_future.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index 904e8a9d5d..4f2f9d272e 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -178,11 +178,12 @@ class AnnotationsFutureTestCase(unittest.TestCase):
eq('-1')
eq('~int and not v1 ^ 123 + v2 | True')
eq('a + (not b)')
+ eq('lambda: None')
eq('lambda arg: None')
eq('lambda a=True: a')
eq('lambda a, b, c=True: a')
eq("lambda a, b, c=True, *, d=1 << v2, e='str': a")
- eq("lambda a, b, c=True, *vararg, d=v1 << 2, e='str', **kwargs: a + b")
+ eq("lambda a, b, c=True, *vararg, d, e='str', **kwargs: a + b")
eq('lambda x: lambda y: x + y')
eq('1 if True else 2')
eq('str or None if int or True else str or bytes or None')