bpo-34850: Emit a warning for "is" and "is not" with a literal. (GH-9642)

This commit is contained in:
Serhiy Storchaka 2019-01-18 07:47:48 +02:00 committed by GitHub
parent e55cf024ca
commit 3bcbedc9f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 11 deletions

View file

@ -1146,11 +1146,12 @@ class ASTValidatorTests(unittest.TestCase):
tests = [fn for fn in os.listdir(stdlib) if fn.endswith(".py")]
tests.extend(["test/test_grammar.py", "test/test_unpack_ex.py"])
for module in tests:
fn = os.path.join(stdlib, module)
with open(fn, "r", encoding="utf-8") as fp:
source = fp.read()
mod = ast.parse(source, fn)
compile(mod, fn, "exec")
with self.subTest(module):
fn = os.path.join(stdlib, module)
with open(fn, "r", encoding="utf-8") as fp:
source = fp.read()
mod = ast.parse(source, fn)
compile(mod, fn, "exec")
class ConstantTests(unittest.TestCase):