summaryrefslogtreecommitdiff
path: root/Lib/test/test_parser.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-05 12:09:41 +0000
committerGeorg Brandl <georg@python.org>2008-12-05 12:09:41 +0000
commitfe879e8a23e61c97aa461d65d0ac495a8a5f4692 (patch)
tree251e5ed47b56e19402bb41ae4772c62c463d96f5 /Lib/test/test_parser.py
parent3129ea2e0590c2f53e0c89e990d0fd23d3aac88d (diff)
downloadcpython-git-fe879e8a23e61c97aa461d65d0ac495a8a5f4692.tar.gz
#4529: fix parser's validation for try-except-finally statements.
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r--Lib/test/test_parser.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index 1069606cff..23f418ee39 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -200,6 +200,16 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
self.check_suite("with open('x'): pass\n")
self.check_suite("with open('x') as f: pass\n")
+ def test_try_stmt(self):
+ self.check_suite("try: pass\nexcept: pass\n")
+ self.check_suite("try: pass\nfinally: pass\n")
+ self.check_suite("try: pass\nexcept A: pass\nfinally: pass\n")
+ self.check_suite("try: pass\nexcept A: pass\nexcept: pass\n"
+ "finally: pass\n")
+ self.check_suite("try: pass\nexcept: pass\nelse: pass\n")
+ self.check_suite("try: pass\nexcept: pass\nelse: pass\n"
+ "finally: pass\n")
+
def test_position(self):
# An absolutely minimal test of position information. Better
# tests would be a big project.