[Python-checkins] python/dist/src/Lib/test test_compile.py, 1.20, 1.21

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Jul 17 23:46:27 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv414/Lib/test

Modified Files:
	test_compile.py 
Log Message:
Upgrade None assignment SyntaxWarning to a SyntaxError.

Index: test_compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** test_compile.py	29 Nov 2003 23:52:12 -0000	1.20
--- test_compile.py	17 Jul 2004 21:46:25 -0000	1.21
***************
*** 139,142 ****
--- 139,157 ----
          self.assertEqual(j, -1)
  
+     def test_none_assignment(self):
+         stmts = [
+             'None = 0',
+             'None += 0',
+             '__builtins__.None = 0',
+             'def None(): pass',
+             'class None: pass',
+             '(a, None) = 0, 0',
+             'for None in range(10): pass',
+             'def f(None): pass',
+         ]
+         for stmt in stmts:
+             stmt += "\n"
+             self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'single')
+             self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec')
  
  def test_main():



More information about the Python-checkins mailing list