]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #13436: Add a test to make sure that ast.ImportFrom(level=None) works
authorBerker Peksag <berker.peksag@gmail.com>
Fri, 29 Apr 2016 16:50:02 +0000 (19:50 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Fri, 29 Apr 2016 16:50:02 +0000 (19:50 +0300)
Lib/test/test_ast.py

index a025c20006c6265188888b481bacb27eac2e1ced..7b43be6dfc2ac1e220dd39650cd1aba6ad895c31 100644 (file)
@@ -548,6 +548,17 @@ class ASTHelpers_Test(unittest.TestCase):
             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):