diff options
author | Georg Brandl <georg@python.org> | 2008-12-05 12:09:41 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-12-05 12:09:41 +0000 |
commit | fe879e8a23e61c97aa461d65d0ac495a8a5f4692 (patch) | |
tree | 251e5ed47b56e19402bb41ae4772c62c463d96f5 /Lib/test/test_parser.py | |
parent | 3129ea2e0590c2f53e0c89e990d0fd23d3aac88d (diff) | |
download | cpython-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.py | 10 |
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. |