Skip to content

Commit 3fe2f15

Browse files
committed
Test that top-level aliases point to modules with normal __name__
1 parent 05e0878 commit 3fe2f15

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/deprecation/test_toplevel.py

+20
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,26 @@ def test_util_alias_import() -> None:
102102
"""Targets of private aliases in the git module to some modules, not including util."""
103103

104104

105+
_PRIVATE_MODULE_ALIAS_TARGET_NAMES = (
106+
"git.refs.head",
107+
"git.refs.log",
108+
"git.refs.reference",
109+
"git.refs.symbolic",
110+
"git.refs.tag",
111+
"git.index.base",
112+
"git.index.fun",
113+
"git.index.typ",
114+
)
115+
"""Expected ``__name__`` attributes of targets of private aliases in the git module."""
116+
117+
118+
def test_alias_target_module_names_are_by_location() -> None:
119+
"""The aliases are weird, but their targets are normal, even in ``__name__``."""
120+
actual = [module.__name__ for module in _PRIVATE_MODULE_ALIAS_TARGETS]
121+
expected = list(_PRIVATE_MODULE_ALIAS_TARGET_NAMES)
122+
assert actual == expected
123+
124+
105125
def test_private_module_alias_access() -> None:
106126
"""Non-util private alias access works but warns and is a deliberate mypy error."""
107127
with pytest.deprecated_call() as ctx:

0 commit comments

Comments
 (0)