Avoid naming conflicts when importing multiple types with the same name from an ancestor package

This commit is contained in:
boukeversteegh
2020-07-01 12:07:59 +02:00
parent e3135ce766
commit 81711d2427
2 changed files with 9 additions and 7 deletions

View File

@@ -214,8 +214,8 @@ def test_reference_root_package_from_child():
package="package.child", imports=imports, source_type="Message"
)
assert imports == {"from ... import Message"}
assert name == "Message"
assert imports == {"from ... import Message as __Message__"}
assert name == "__Message__"
def test_reference_root_package_from_deeply_nested_child():
@@ -224,8 +224,8 @@ def test_reference_root_package_from_deeply_nested_child():
package="package.deeply.nested.child", imports=imports, source_type="Message"
)
assert imports == {"from ..... import Message"}
assert name == "Message"
assert imports == {"from ..... import Message as ____Message__"}
assert name == "____Message__"
def test_reference_unrelated_package():