diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-10 01:54:06 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-10 01:54:06 (GMT) |
commit | 9caf9c040e4cf176eb926a077ae7bcdb6550160b (patch) | |
tree | c13033f8a978abb6774da5cc7a401ef1bd1d4ae7 /Lib/test/test_parser.py | |
parent | 573e03348893a762d966d945230a34519e68618e (diff) | |
download | cpython-9caf9c040e4cf176eb926a077ae7bcdb6550160b.zip cpython-9caf9c040e4cf176eb926a077ae7bcdb6550160b.tar.gz cpython-9caf9c040e4cf176eb926a077ae7bcdb6550160b.tar.bz2 |
Add tests and news entry about parser errors from bug #678518.
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r-- | Lib/test/test_parser.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index 81708b5..d78344e 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -134,6 +134,13 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase): self.check_suite("import sys as system, math") self.check_suite("import sys, math as my_math") + def test_pep263(self): + self.check_suite("# -*- coding: iso-8859-1 -*-\n" + "pass\n") + + def test_assert(self): + self.check_suite("assert alo < ahi and blo < bhi\n") + # # Second, we take *invalid* trees and make sure we get ParserError # rejections for them. @@ -355,6 +362,16 @@ class IllegalSyntaxTestCase(unittest.TestCase): (0, '')) self.check_bad_tree(tree, "a $= b") + def test_malformed_global(self): + #doesn't have global keyword in ast + tree = (257, + (264, + (265, + (266, + (282, (1, 'foo'))), (4, ''))), + (4, ''), + (0, '')) + self.check_bad_tree(tree, "malformed global ast") def test_main(): loader = unittest.TestLoader() |