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 | 2f98f1dbb8a7ac2ff55a900015eab78a0a71761a (patch) | |
tree | 7fed93c78a42d684ea9df1d0e9119510a5ab02c3 /Lib/test/test_parser.py | |
parent | 26236d26d0a2302acbf43faab76d240f9f06e1e3 (diff) | |
download | cpython-2f98f1dbb8a7ac2ff55a900015eab78a0a71761a.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. |