Skip to content
Snippets Groups Projects
Commit 31d57ff9 authored by Claudiu Popa's avatar Claudiu Popa Committed by GitHub
Browse files

Revert "Fix namespace population when wildcard import is used"

parent 3e6ef999
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -214,7 +214,7 @@ class AstroidBuilder(raw_building.InspectBuilder):
imported = node.do_import_module()
except exceptions.AstroidBuildingError:
continue
for name in imported.wildcard_import_names():
for name in imported.public_names():
node.parent.set_local(name, node)
sort_locals(node.parent.scope().locals[name])
else:
Loading
Loading
Loading
Loading
@@ -767,27 +767,5 @@ class TestGuessEncoding(unittest.TestCase):
self.assertIsNone(e)
 
 
class TestImportAll(unittest.TestCase):
def setUp(self):
self.astroid_builder = builder.AstroidBuilder()
def test_x(self):
m1_string = """
__all__ = ['a', 'b', 'c']
a = 1
b = 2
c = 3
d = 4
"""
m2_string = "from m1 import *"
m1 = builder.parse(m1_string, 'm1')
m2 = builder.parse(m2_string, 'm2')
exported = ['a', 'b', 'c']
self.assertEqual(m1.wildcard_import_names(), exported)
self.assertEqual(len(m2.locals), 3)
for n in exported:
self.assertIn(n, m2.locals)
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment