diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_compile.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index e2b1c9500d..5b7b7170df 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -138,6 +138,21 @@ if 1: self.assertEqual(i, 1) 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(): test_support.run_unittest(TestSpecifics) |