Skip to content

Commit 246cc17

Browse files
committed
Use names directly on other tests
The tests are written broadly (per the style elsewhere in this test suite), but narrowing the message-checking tests in this specific way has the further advantage that the logic of the code under test will be less reflected in the logic of the tests, so that bugs are less likely to be missed by being duplicated across code and tests.
1 parent 3fe2f15 commit 246cc17

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/deprecation/test_toplevel.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def test_private_module_alias_access() -> None:
141141

142142
assert len(messages) == len(_PRIVATE_MODULE_ALIAS_TARGETS)
143143

144-
for target, message in zip(_PRIVATE_MODULE_ALIAS_TARGETS, messages):
145-
assert message.endswith(f"Use {target.__name__} instead.")
144+
for fullname, message in zip(_PRIVATE_MODULE_ALIAS_TARGET_NAMES, messages):
145+
assert message.endswith(f"Use {fullname} instead.")
146146

147147

148148
def test_private_module_alias_import() -> None:
@@ -177,8 +177,8 @@ def test_private_module_alias_import() -> None:
177177

178178
assert len(messages) == len(_PRIVATE_MODULE_ALIAS_TARGETS)
179179

180-
for target, message in zip(_PRIVATE_MODULE_ALIAS_TARGETS, messages):
181-
assert message.endswith(f"Use {target.__name__} instead.")
180+
for fullname, message in zip(_PRIVATE_MODULE_ALIAS_TARGET_NAMES, messages):
181+
assert message.endswith(f"Use {fullname} instead.")
182182

183183

184184
def test_dir_contains_public_attributes() -> None:

0 commit comments

Comments
 (0)