summaryrefslogtreecommitdiff
path: root/Demo/parser/test_unparse.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-30 08:32:11 +0000
committerMark Dickinson <dickinsm@gmail.com>2010-06-30 08:32:11 +0000
commit8d6d760422b56f69e57d009fa26eabcc49935afe (patch)
tree275339a9878be15fb2902fc54774f7226ec8a9d3 /Demo/parser/test_unparse.py
parent719e4e3ba5a04bec52a04414383781ece8df1ef3 (diff)
downloadcpython-git-8d6d760422b56f69e57d009fa26eabcc49935afe.tar.gz
Collapse else: if: ... into elif:
Diffstat (limited to 'Demo/parser/test_unparse.py')
-rw-r--r--Demo/parser/test_unparse.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Demo/parser/test_unparse.py b/Demo/parser/test_unparse.py
index f4a3e66113..7d85f16cfd 100644
--- a/Demo/parser/test_unparse.py
+++ b/Demo/parser/test_unparse.py
@@ -64,6 +64,24 @@ class_decorator = """\
class Foo: pass
"""
+elif1 = """\
+if cond1:
+ suite1
+elif cond2:
+ suite2
+else:
+ suite3
+"""
+
+elif2 = """\
+if cond1:
+ suite1
+elif cond2:
+ suite2
+"""
+
+
+
class ASTTestCase(unittest.TestCase):
def assertASTEqual(self, ast1, ast2):
self.assertEqual(ast.dump(ast1), ast.dump(ast2))
@@ -159,6 +177,10 @@ class UnparseTestCase(ASTTestCase):
def test_class_definition(self):
self.check_roundtrip("class A(metaclass=type, *[], **{}): pass")
+ def test_elifs(self):
+ self.check_roundtrip(elif1)
+ self.check_roundtrip(elif2)
+
class DirectoryTestCase(ASTTestCase):
"""Test roundtrip behaviour on all files in Lib and Lib/test."""