summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_parser.py
diff options
context:
space:
mode:
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 17d1988..2f1310b 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -193,6 +193,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.