Issue #14965: Fix missing support for starred assignments in Tools/parser/unparse.py.

This commit is contained in:
Mark Dickinson 2012-05-06 17:27:39 +01:00
parent 9ab3fdd8cb
commit 1b2e9444fe
3 changed files with 17 additions and 0 deletions

View file

@ -209,6 +209,13 @@ class UnparseTestCase(ASTTestCase):
def test_try_except_finally(self):
self.check_roundtrip(try_except_finally)
def test_starred_assignment(self):
self.check_roundtrip("a, *b, c = seq")
self.check_roundtrip("a, (*b, c) = seq")
self.check_roundtrip("a, *b[0], c = seq")
self.check_roundtrip("a, *(b, c) = seq")
class DirectoryTestCase(ASTTestCase):
"""Test roundtrip behaviour on all files in Lib and Lib/test."""

View file

@ -472,6 +472,10 @@ class Unparser:
self.dispatch(t.slice)
self.write("]")
def _Starred(self, t):
self.write("*")
self.dispatch(t.value)
# slice
def _Ellipsis(self, t):
self.write("...")