]> granicus.if.org Git - python/commitdiff
Add tests and news entry about parser errors from bug #678518.
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 10 Feb 2003 01:54:06 +0000 (01:54 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 10 Feb 2003 01:54:06 +0000 (01:54 +0000)
Lib/test/test_parser.py
Misc/NEWS

index 81708b5309539915a5fb7d7c2c26bd3f377a0c36..d78344ed812488559f83d4639206d4559e57a381 100644 (file)
@@ -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()
index d262b67bf22983ce879ff5f1a0231efd5f3ba18e..b0683ee87725f491984afda2e6e66363ff1284ff 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,8 @@ Core and builtins
 Extension modules
 -----------------
 
+- Fix some bugs in the parser module.  SF bug #678518.
+
 - Thanks to Scott David Daniels, a subtle bug in how the zlib
   extension implemented flush() was fixed.  Scott also rewrote the
   zlib test suite using the unittest module.  (SF bug #640230 and