summaryrefslogtreecommitdiffstats
path: root/Demo/parser/test_unparse.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-30 08:46:53 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-06-30 08:46:53 (GMT)
commit81ad8ccdfbabbfbda2ad304e8dbbfec84625f485 (patch)
treeff59785f83fe72f1cdc80e10030937898ea767bc /Demo/parser/test_unparse.py
parent8d6d760422b56f69e57d009fa26eabcc49935afe (diff)
downloadcpython-81ad8ccdfbabbfbda2ad304e8dbbfec84625f485.zip
cpython-81ad8ccdfbabbfbda2ad304e8dbbfec84625f485.tar.gz
cpython-81ad8ccdfbabbfbda2ad304e8dbbfec84625f485.tar.bz2
Output try-except-finally statements where appropriate.
Diffstat (limited to 'Demo/parser/test_unparse.py')
-rw-r--r--Demo/parser/test_unparse.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/Demo/parser/test_unparse.py b/Demo/parser/test_unparse.py
index 7d85f16..3a795e9 100644
--- a/Demo/parser/test_unparse.py
+++ b/Demo/parser/test_unparse.py
@@ -80,7 +80,18 @@ elif cond2:
suite2
"""
-
+try_except_finally = """\
+try:
+ suite1
+except ex1:
+ suite2
+except ex2:
+ suite3
+else:
+ suite4
+finally:
+ suite5
+"""
class ASTTestCase(unittest.TestCase):
def assertASTEqual(self, ast1, ast2):
@@ -181,6 +192,9 @@ class UnparseTestCase(ASTTestCase):
self.check_roundtrip(elif1)
self.check_roundtrip(elif2)
+ def test_try_except_finally(self):
+ self.check_roundtrip(try_except_finally)
+
class DirectoryTestCase(ASTTestCase):
"""Test roundtrip behaviour on all files in Lib and Lib/test."""