mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Upgrade None assignment SyntaxWarning to a SyntaxError.
This commit is contained in:
parent
910d8f1e89
commit
11a70c79b9
2 changed files with 21 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue