cpython: Issue #13436: Add a test to make sure that ast.ImportFrom(level=None) works

https://hg.python.org/cpython/rev/59638baee25e changeset: 101187:59638baee25e user: Berker Peksag <berker.peksag@gmail.com> date: Fri Apr 29 19:50:02 2016 +0300 summary: Issue #13436: Add a test to make sure that ast.ImportFrom(level=None) works files: Lib/test/test_ast.py | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -548,6 +548,17 @@ compile(mod, 'test', 'exec') self.assertIn("invalid integer value: None", str(cm.exception)) + def test_level_as_none(self): + body = [ast.ImportFrom(module='time', + names=[ast.alias(name='sleep')], + level=None, + lineno=0, col_offset=0)] + mod = ast.Module(body) + code = compile(mod, 'test', 'exec') + ns = {} + exec(code, ns) + self.assertIn('sleep', ns) + class ASTValidatorTests(unittest.TestCase): -- Repository URL: https://hg.python.org/cpython
participants (1)
-
berker.peksag