| OLD | NEW |
| 1 import parser | 1 import parser |
| 2 import os | 2 import os |
| 3 import unittest | 3 import unittest |
| 4 import sys | 4 import sys |
| 5 from test import test_support | 5 from test import test_support |
| 6 | 6 |
| 7 # | 7 # |
| 8 # First, we test that we can generate trees from valid source fragments, | 8 # First, we test that we can generate trees from valid source fragments, |
| 9 # and that these valid trees are indeed allowed by the tree-loading side | 9 # and that these valid trees are indeed allowed by the tree-loading side |
| 10 # of the parser module. | 10 # of the parser module. |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 def test_pep263(self): | 192 def test_pep263(self): |
| 193 self.check_suite("# -*- coding: iso-8859-1 -*-\n" | 193 self.check_suite("# -*- coding: iso-8859-1 -*-\n" |
| 194 "pass\n") | 194 "pass\n") |
| 195 | 195 |
| 196 def test_assert(self): | 196 def test_assert(self): |
| 197 self.check_suite("assert alo < ahi and blo < bhi\n") | 197 self.check_suite("assert alo < ahi and blo < bhi\n") |
| 198 | 198 |
| 199 def test_with(self): | 199 def test_with(self): |
| 200 self.check_suite("with open('x'): pass\n") | 200 self.check_suite("with open('x'): pass\n") |
| 201 self.check_suite("with open('x') as f: pass\n") | 201 self.check_suite("with open('x') as f: pass\n") |
| 202 self.check_suite("with open('x') as f, open('y') as g: pass\n") |
| 202 | 203 |
| 203 def test_try_stmt(self): | 204 def test_try_stmt(self): |
| 204 self.check_suite("try: pass\nexcept: pass\n") | 205 self.check_suite("try: pass\nexcept: pass\n") |
| 205 self.check_suite("try: pass\nfinally: pass\n") | 206 self.check_suite("try: pass\nfinally: pass\n") |
| 206 self.check_suite("try: pass\nexcept A: pass\nfinally: pass\n") | 207 self.check_suite("try: pass\nexcept A: pass\nfinally: pass\n") |
| 207 self.check_suite("try: pass\nexcept A: pass\nexcept: pass\n" | 208 self.check_suite("try: pass\nexcept A: pass\nexcept: pass\n" |
| 208 "finally: pass\n") | 209 "finally: pass\n") |
| 209 self.check_suite("try: pass\nexcept: pass\nelse: pass\n") | 210 self.check_suite("try: pass\nexcept: pass\nelse: pass\n") |
| 210 self.check_suite("try: pass\nexcept: pass\nelse: pass\n" | 211 self.check_suite("try: pass\nexcept: pass\nelse: pass\n" |
| 211 "finally: pass\n") | 212 "finally: pass\n") |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 test_support.run_unittest( | 529 test_support.run_unittest( |
| 529 RoundtripLegalSyntaxTestCase, | 530 RoundtripLegalSyntaxTestCase, |
| 530 IllegalSyntaxTestCase, | 531 IllegalSyntaxTestCase, |
| 531 CompileTestCase, | 532 CompileTestCase, |
| 532 ParserStackLimitTestCase, | 533 ParserStackLimitTestCase, |
| 533 ) | 534 ) |
| 534 | 535 |
| 535 | 536 |
| 536 if __name__ == "__main__": | 537 if __name__ == "__main__": |
| 537 test_main() | 538 test_main() |
| OLD | NEW |