mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
#4529: fix parser's validation for try-except-finally statements.
This commit is contained in:
parent
3129ea2e05
commit
fe879e8a23
3 changed files with 36 additions and 23 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue