Replace noop constant statement with expression

* Constant statements will be ignored and the compiler will emit a
  SyntaxWarning.
* Replace constant statement (ex: "1") with an expression statement
  (ex: "x=1").
* test_traceback: use context manager on the file.

Issue #26204.
This commit is contained in:
Victor Stinner 2016-02-08 17:57:02 +01:00
parent f089196beb
commit 51d8c526d5
5 changed files with 23 additions and 20 deletions

View file

@ -230,7 +230,8 @@ class TestSupport(unittest.TestCase):
def test_check_syntax_error(self):
support.check_syntax_error(self, "def class")
self.assertRaises(AssertionError, support.check_syntax_error, self, "1")
with self.assertRaises(AssertionError):
support.check_syntax_error(self, "x=1")
def test_CleanImport(self):
import importlib