summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/import_
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-08-30 18:28:46 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-08-30 18:28:46 (GMT)
commit9e0e1a63c840b4d0fdf4d088ad4da2db7918f8a0 (patch)
tree18de2506ed9ceb344eb6a3c6b81f4f820a3d2137 /Lib/importlib/test/import_
parent12c3fc934376d89168f5b072a833aa7bdd4ecd60 (diff)
downloadcpython-9e0e1a63c840b4d0fdf4d088ad4da2db7918f8a0.zip
cpython-9e0e1a63c840b4d0fdf4d088ad4da2db7918f8a0.tar.gz
cpython-9e0e1a63c840b4d0fdf4d088ad4da2db7918f8a0.tar.bz2
Allow importlib.__import__ to accept any iterable for fromlist. Discovered when
running importlib against test___all__.
Diffstat (limited to 'Lib/importlib/test/import_')
-rw-r--r--Lib/importlib/test/import_/test_fromlist.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/importlib/test/import_/test_fromlist.py b/Lib/importlib/test/import_/test_fromlist.py
index 340235b..14ea5bf 100644
--- a/Lib/importlib/test/import_/test_fromlist.py
+++ b/Lib/importlib/test/import_/test_fromlist.py
@@ -84,16 +84,23 @@ class HandlingFromlist(unittest.TestCase):
module = import_util.import_('pkg.mod', fromlist=[''])
self.assertEquals(module.__name__, 'pkg.mod')
- def test_using_star(self):
+ def basic_star_test(self, fromlist=['*']):
# [using *]
with util.mock_modules('pkg.__init__', 'pkg.module') as mock:
with util.import_state(meta_path=[mock]):
mock['pkg'].__all__ = ['module']
- module = import_util.import_('pkg', fromlist=['*'])
+ module = import_util.import_('pkg', fromlist=fromlist)
self.assertEquals(module.__name__, 'pkg')
self.assertTrue(hasattr(module, 'module'))
self.assertEqual(module.module.__name__, 'pkg.module')
+ def test_using_star(self):
+ # [using *]
+ self.basic_star_test()
+
+ def test_fromlist_as_tuple(self):
+ self.basic_star_test(('*',))
+
def test_star_with_others(self):
# [using * with others]
context = util.mock_modules('pkg.__init__', 'pkg.module1', 'pkg.module2')