@@ -824,11 +824,17 @@ def test_inner(extra_burning_oil = 1, count=0): |
|
|
824 |
824 |
test_inner() |
825 |
825 |
|
826 |
826 |
def test_return(self): |
827 |
|
-# 'return' [testlist] |
|
827 |
+# 'return' [testlist_star_expr] |
828 |
828 |
def g1(): return |
829 |
829 |
def g2(): return 1 |
|
830 |
+def g3(): |
|
831 |
+z = [2, 3] |
|
832 |
+return 1, *z |
|
833 |
+ |
830 |
834 |
g1() |
831 |
835 |
x = g2() |
|
836 |
+y = g3() |
|
837 |
+self.assertEqual(y, (1, 2, 3), "unparenthesized star expr return") |
832 |
838 |
check_syntax_error(self, "class foo:return 1") |
833 |
839 |
|
834 |
840 |
def test_break_in_finally(self): |
@@ -981,6 +987,9 @@ def g(): f((yield 1)) |
|
|
981 |
987 |
def g(): f((yield 1), 1) |
982 |
988 |
def g(): f((yield from ())) |
983 |
989 |
def g(): f((yield from ()), 1) |
|
990 |
+# Do not require parenthesis for tuple unpacking |
|
991 |
+def g(): rest = 4, 5, 6; yield 1, 2, 3, *rest |
|
992 |
+self.assertEquals(list(g()), [(1, 2, 3, 4, 5, 6)]) |
984 |
993 |
check_syntax_error(self, "def g(): f(yield 1)") |
985 |
994 |
check_syntax_error(self, "def g(): f(yield 1, 1)") |
986 |
995 |
check_syntax_error(self, "def g(): f(yield from ())") |