summaryrefslogtreecommitdiffstats
path: root/Tools/parser/test_unparse.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-05-06 16:35:19 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-05-06 16:35:19 (GMT)
commitfe8440aec00af5bc2e995aaad205efa2e693a364 (patch)
tree853a6812968c57038f4e1afdaf94b27b54d0a822 /Tools/parser/test_unparse.py
parent6dbca367dceda3999979bdc3cdcfdb201f40d044 (diff)
parent1b2e9444fe9eeaef971d498445ebad7fce27f0b9 (diff)
downloadcpython-fe8440aec00af5bc2e995aaad205efa2e693a364.zip
cpython-fe8440aec00af5bc2e995aaad205efa2e693a364.tar.gz
cpython-fe8440aec00af5bc2e995aaad205efa2e693a364.tar.bz2
Issue #14965: Bring Tools/parser/unparse.py up to date with the Python 3.3. Grammar.
Diffstat (limited to 'Tools/parser/test_unparse.py')
-rw-r--r--Tools/parser/test_unparse.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Tools/parser/test_unparse.py b/Tools/parser/test_unparse.py
index d457523..647366c 100644
--- a/Tools/parser/test_unparse.py
+++ b/Tools/parser/test_unparse.py
@@ -93,6 +93,21 @@ finally:
suite5
"""
+with_simple = """\
+with f():
+ suite1
+"""
+
+with_as = """\
+with f() as x:
+ suite1
+"""
+
+with_two_items = """\
+with f() as x, g() as y:
+ suite1
+"""
+
class ASTTestCase(unittest.TestCase):
def assertASTEqual(self, ast1, ast2):
self.assertEqual(ast.dump(ast1), ast.dump(ast2))
@@ -209,6 +224,22 @@ 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")
+
+ def test_with_simple(self):
+ self.check_roundtrip(with_simple)
+
+ def test_with_as(self):
+ self.check_roundtrip(with_as)
+
+ def test_with_two_items(self):
+ self.check_roundtrip(with_two_items)
+
+
class DirectoryTestCase(ASTTestCase):
"""Test roundtrip behaviour on all files in Lib and Lib/test."""