Skip to content

Commit 96c0d95

Browse files
committed
Python: Illustrate that clashing_attr can be submodule
1 parent 13ae98e commit 96c0d95

File tree

1 file changed

+4
-0
lines changed
  • python/ql/test/experimental/import-resolution

1 file changed

+4
-0
lines changed

python/ql/test/experimental/import-resolution/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ def local_import():
8484
check("clashing_attr", clashing_attr, "clashing_attr", globals()) #$ prints=clashing_attr SPURIOUS: prints="<module attr_clash.clashing_attr>"
8585
check("non_clashing_submodule", non_clashing_submodule, "<module attr_clash.non_clashing_submodule>", globals()) #$ prints="<module attr_clash.non_clashing_submodule>"
8686

87+
import attr_clash.clashing_attr as _doesnt_matter #$ imports=attr_clash.clashing_attr as=_doesnt_matter
88+
from attr_clash import clashing_attr, non_clashing_submodule #$ imports=attr_clash.clashing_attr as=clashing_attr imports=attr_clash.non_clashing_submodule as=non_clashing_submodule
89+
check("clashing_attr", clashing_attr, "<module attr_clash.clashing_attr>", globals()) #$ prints="<module attr_clash.clashing_attr>" SPURIOUS: prints=clashing_attr
90+
8791
# check that import * only imports the __all__ attributes
8892
from has_defined_all import *
8993
check("all_defined_foo", all_defined_foo, "all_defined_foo", globals()) #$ prints=all_defined_foo

0 commit comments

Comments
 (0)