summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-04-29 16:50:02 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-04-29 16:50:02 (GMT)
commit0a5bd51dd30762e3e3b0f3b00ffe7899b9c58317 (patch)
tree287918fdef2efe1bb7d9551d02d4cf41462717cd /Lib/test/test_ast.py
parentdd745cc3ff853fd5b641c035a860f0ac84f2b401 (diff)
downloadcpython-0a5bd51dd30762e3e3b0f3b00ffe7899b9c58317.zip
cpython-0a5bd51dd30762e3e3b0f3b00ffe7899b9c58317.tar.gz
cpython-0a5bd51dd30762e3e3b0f3b00ffe7899b9c58317.tar.bz2
Issue #13436: Add a test to make sure that ast.ImportFrom(level=None) works
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index a025c20..7b43be6 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -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):