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

Lines changed: 20 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy