Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18608e4

Browse files
committed
Pick a better name for _MODULE_ALIAS_TARGETS
And add a docstring to document it, mainly to clarify that util isintentionally omitted from that constant.
1 parent074bbc7 commit18608e4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎test/deprecation/test_attributes.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_util_alias_import() -> None:
8585

8686

8787
# Split out util and have all its tests be separate, above.
88-
_MODULE_ALIAS_TARGETS= (
88+
_PRIVATE_MODULE_ALIAS_TARGETS= (
8989
git.refs.head,
9090
git.refs.log,
9191
git.refs.reference,
@@ -95,6 +95,7 @@ def test_util_alias_import() -> None:
9595
git.index.fun,
9696
git.index.typ,
9797
)
98+
"""Targets of private aliases in the git module to some modules, not including util."""
9899

99100

100101
deftest_private_module_alias_access()->None:
@@ -109,11 +110,11 @@ def test_private_module_alias_access() -> None:
109110
git.base,# type: ignore[attr-defined]
110111
git.fun,# type: ignore[attr-defined]
111112
git.typ,# type: ignore[attr-defined]
112-
)==_MODULE_ALIAS_TARGETS
113+
)==_PRIVATE_MODULE_ALIAS_TARGETS
113114

114115
# Each should have warned exactly once, and note what to use instead.
115116
messages= [str(w.message)forwinctx]
116-
fortarget,messageinzip(_MODULE_ALIAS_TARGETS,messages,strict=True):
117+
fortarget,messageinzip(_PRIVATE_MODULE_ALIAS_TARGETS,messages,strict=True):
117118
assertmessage.endswith(f"Use{target.__name__} instead.")
118119

119120

@@ -138,13 +139,13 @@ def test_private_module_alias_import() -> None:
138139
base,
139140
fun,
140141
typ,
141-
)==_MODULE_ALIAS_TARGETS
142+
)==_PRIVATE_MODULE_ALIAS_TARGETS
142143

143144
# Each import may warn multiple times. In CPython there will be currently always be
144145
# exactly two warnings per import, possibly due to the equivalent of calling hasattr
145146
# to do a pre-check prior to retrieving the attribute for actual use. However, for
146147
# each import, all messages should be the same and should note what to use instead.
147148
messages_with_duplicates= [str(w.message)forwinctx]
148149
messages= [messageformessage,_initertools.groupby(messages_with_duplicates)]
149-
fortarget,messageinzip(_MODULE_ALIAS_TARGETS,messages,strict=True):
150+
fortarget,messageinzip(_PRIVATE_MODULE_ALIAS_TARGETS,messages,strict=True):
150151
assertmessage.endswith(f"Use{target.__name__} instead.")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp