summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests
diff options
context:
space:
mode:
authorVlad Emelianov <volshebnyi@gmail.com>2020-03-01 19:59:26 (GMT)
committerGitHub <noreply@github.com>2020-03-01 19:59:26 (GMT)
commit768d739c1cd8c1d41902229581811a9b86bcc76e (patch)
tree353a2dcf73b4bfa2247e6612511568c29e508215 /Lib/lib2to3/tests
parent0b0d29fce568e61e0d7d9f4a362e6dbf1e7fb80a (diff)
downloadcpython-768d739c1cd8c1d41902229581811a9b86bcc76e.zip
cpython-768d739c1cd8c1d41902229581811a9b86bcc76e.tar.gz
cpython-768d739c1cd8c1d41902229581811a9b86bcc76e.tar.bz2
bpo-38641: Add lib2to3 support for starred expressions in return/yield statements (GH-16994)
Diffstat (limited to 'Lib/lib2to3/tests')
-rw-r--r--Lib/lib2to3/tests/data/py3_test_grammar.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/lib2to3/tests/data/py3_test_grammar.py b/Lib/lib2to3/tests/data/py3_test_grammar.py
index e0b6828..d062232 100644
--- a/Lib/lib2to3/tests/data/py3_test_grammar.py
+++ b/Lib/lib2to3/tests/data/py3_test_grammar.py
@@ -473,15 +473,27 @@ class GrammarTests(unittest.TestCase):
test_inner()
def testReturn(self):
- # 'return' [testlist]
+ # 'return' [testlist_star_expr]
def g1(): return
def g2(): return 1
+ return_list = [2, 3]
+ def g3(): return 1, *return_list
g1()
x = g2()
+ x3 = g3()
check_syntax_error(self, "class foo:return 1")
def testYield(self):
+ # 'yield' [yield_arg]
+ def g1(): yield 1
+ yield_list = [2, 3]
+ def g2(): yield 1, *yield_list
+ def g3(): yield from iter(yield_list)
+ x1 = g1()
+ x2 = g2()
+ x3 = g3()
check_syntax_error(self, "class foo:yield 1")
+ check_syntax_error(self, "def g4(): yield from *a")
def testRaise(self):
# 'raise' test [',' test]