Skip to content

Commit c7474e2

Browse files
committed
test: name the remaining tests for the behaviour they pin (#2227)
Renames (assertions unchanged): - test_case_sensitivity_from_896_still_holds -> test_get_matches_names_case_sensitively - test_get_is_now_a_classmethod_bound_the_same_way_for_callers -> test_get_is_a_classmethod_that_binds_to_the_class - test_default_still_names_the_unregistered_members_value -> test_default_names_the_unregistered_members_value - test_sibling_registries_now_stay_quiet_on_an_identical_re_registration -> test_sibling_registries_stay_quiet_on_an_identical_re_registration - test_the_two_new_sub_heading_levels_become_atx_headings -> test_dash_and_tilde_sub_headings_become_atx_headings - test_the_two_redundant_overrides_are_gone -> test_the_mh_helpers_define_no_get_override - test_the_all_extra_is_exactly_the_three_core_addon_extras -> test_the_all_extra_is_exactly_the_core_addon_extras - test_literal_is_now_a_role -> test_each_curated_reference_is_a_role_not_a_literal - test_the_four_legs_skip_only_on_a_docs_only_diff -> test_each_leg_skips_only_on_a_docs_only_diff - test_the_three_call_one_head -> test_every_acting_workflow_calls_one_head - test_registered_lookups_are_still_unaffected -> test_registered_words_resolve_to_their_registered_members - test_an_out_of_width_port_still_raises_764s_rejection -> test_an_out_of_width_port_raises_while_an_unassigned_one_resolves Also: the comment and docstring that name two of them, and the change-relative assertion messages and docstring wording in the get override and all-extra checks ("no longer delegates" and kin). Touched files plus tier guard and docstring contract pass.
1 parent 31142a8 commit c7474e2

9 files changed

Lines changed: 23 additions & 24 deletions

‎tests/const/test_const_enum_no_mint.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ def test_method_get_unknown_does_not_mint(self) -> None:
20462046
self.assertEqual(different_case, 'PYPCAPKIT860PROBE2')
20472047
self.assertNotEqual(first, different_case)
20482048

2049-
def test_registered_lookups_are_still_unaffected(self) -> None:
2049+
def test_registered_words_resolve_to_their_registered_members(self) -> None:
20502050
"""A word IANA already assigned still resolves to the same,
20512051
genuinely-registered, identical member every time -- this
20522052
conversion only changes what happens for a word that is not one of

‎tests/const/test_const_method_value_lookup_908_unit.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_an_exact_name_match_still_wins_and_ignores_a_supplied_default(self) ->
126126
class PreservedBehaviourTests(unittest.TestCase):
127127
"""The two settled behaviours the fix must not disturb."""
128128

129-
def test_case_sensitivity_from_896_still_holds(self) -> None:
129+
def test_get_matches_names_case_sensitively(self) -> None:
130130
"""RFC 9110 Section 9.1, via GitHub issue #896: a name match is
131131
case-**sensitive**, so ``get('get')`` must not resolve to
132132
:attr:`Method.GET`. Fails against a naive fix that resolves ``key``
@@ -158,7 +158,7 @@ class DefaultSignatureTests(unittest.TestCase):
158158
rather than widening to the base's ``NO_DEFAULT`` sentinel -- see the
159159
module docstring's reasoning."""
160160

161-
def test_default_still_names_the_unregistered_members_value(self) -> None:
161+
def test_default_names_the_unregistered_members_value(self) -> None:
162162
"""Omitted or ``None``, ``default`` uses ``key`` itself; supplied,
163163
it replaces the *value* of the freshly minted unregistered member --
164164
the same with or without #908's fix, and distinct from the base's own
@@ -177,10 +177,9 @@ def test_default_still_names_the_unregistered_members_value(self) -> None:
177177

178178
self.assertEqual(len(Method.__members__), before)
179179

180-
def test_get_is_now_a_classmethod_bound_the_same_way_for_callers(self) -> None:
181-
"""The ``staticmethod`` -> ``classmethod`` switch GitHub issue #908's
182-
own correction required is invisible to a caller: ``Method.get('X')``
183-
binds identically either way."""
180+
def test_get_is_a_classmethod_that_binds_to_the_class(self) -> None:
181+
"""``get`` is a ``classmethod``, the shape GitHub issue #908's own
182+
correction required, and ``Method.get('X')`` binds to the class."""
184183
from pcapkit.const.http.method import Method
185184

186185
self.assertIsInstance(inspect.getattr_static(Method, 'get'), classmethod)

‎tests/corekit/test_fields_numbers_port_option_no_mint_unit.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def test_a_documented_span_still_mints_its_own_bounded_member(self) -> None:
233233
self.assertEqual(resolved.svc, 'reserved')
234234
self.assertEqual(resolved.port, 230)
235235

236-
def test_an_out_of_width_port_still_raises_764s_rejection(self) -> None:
236+
def test_an_out_of_width_port_raises_while_an_unassigned_one_resolves(self) -> None:
237237
"""The bounded fallback must not revert GitHub pull request #764.
238238
239239
``post_process`` is reachable directly -- not only through ``unpack``,

‎tests/foundation/registry/test_protocols.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_register_protocol_stays_quiet_when_nothing_is_displaced(self) -> None:
179179
"""A fresh key and an identical re-registration are both silent.
180180
181181
The code-keyed siblings share this identity guard too (#718) -- see
182-
``test_sibling_registries_now_stay_quiet_on_an_identical_re_registration`` in
182+
``test_sibling_registries_stay_quiet_on_an_identical_re_registration`` in
183183
this file. Here the key is *derived* from the class rather than supplied by
184184
the caller, and this function is the funnel every wrapper registrar ends in,
185185
so registering one class under two codes -- supported, and exactly what
@@ -232,7 +232,7 @@ def test_register_protocol_stays_quiet_when_nothing_is_displaced(self) -> None:
232232
self.assertIs(udp_registry[udp_port], UnitProtocol)
233233
self.assertEqual(self._registry_warnings(caught, RegistryWarning), [])
234234

235-
def test_sibling_registries_now_stay_quiet_on_an_identical_re_registration(self) -> None:
235+
def test_sibling_registries_stay_quiet_on_an_identical_re_registration(self) -> None:
236236
"""GitHub issue #718: the siblings share ``register_protocol``'s guard.
237237
238238
A repeat registration naming the exact same class stays silent, exactly

‎tests/project/test_changelog_md.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def test_a_sub_heading_underline_joined_into_the_prose_is_fatal(self) -> None:
604604
self._reject('\nA sub heading\n^^^^^^^^^^^^^\n\nSome prose.\n',
605605
'setext underline joined')
606606

607-
def test_the_two_new_sub_heading_levels_become_atx_headings(self) -> None:
607+
def test_dash_and_tilde_sub_headings_become_atx_headings(self) -> None:
608608
# The other half: ``-`` and ``~`` *convert* rather than being rejected, one
609609
# ATX level deeper each, so that the by-module sections and their
610610
# Added/Changed/Fixed subsections survive into ``CHANGELOG.md``. Against a

‎tests/project/test_conventions_doc_claims.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -786,15 +786,15 @@ def test_a_delegating_override_is_a_classmethod(self) -> 'None':
786786
# so it is a live failure mode rather than a hypothetical one. The KeyError
787787
# fails the test either way, so nothing regressed silently; what it does not do
788788
# is say *which* class stopped defining `get`, or that the page is then wrong to
789-
# list it. The sibling at `test_the_two_redundant_overrides_are_gone` already
789+
# list it. The sibling at `test_the_mh_helpers_define_no_get_override` already
790790
# does this the right way round, with `assertNotIn('get', vars(klass))`.
791791
# Deliberately *not* under `subTest`: a subTest records its failure and lets
792792
# the method run on, so the bare `KeyError` this guard exists to pre-empt
793793
# would still be raised by the indexing below and reported alongside it. A
794794
# plain assertion aborts here, which is the whole point.
795795
for klass in (Method, Command, OptionType):
796796
self.assertIn('get', vars(klass),
797-
f'{klass.__name__} no longer defines a get of its own, so '
797+
f'{klass.__name__} defines no get of its own, so '
798798
'the page is wrong to name it among the overrides -- an '
799799
'override folded into the inherited base is what #940 did '
800800
'to the mh/ngap helpers')
@@ -809,8 +809,8 @@ def test_a_delegating_override_is_a_classmethod(self) -> 'None':
809809
'followed it')
810810
self.assertIn('return super().get(key)',
811811
inspect.getsource(vars(klass)['get'].__func__),
812-
f'{klass.__name__}.get no longer delegates, so the page is '
813-
'wrong to give it as a delegating override')
812+
f'{klass.__name__}.get does not delegate to super().get(key), '
813+
'so the page is wrong to give it as a delegating override')
814814
self.assertIsInstance(vars(OptionType)['get'], staticmethod)
815815
self.assertNotIn('super()', inspect.getsource(vars(OptionType)['get'].__func__),
816816
'OptionType.get delegates to super(), so the page is wrong to list it '
@@ -948,7 +948,7 @@ def _restore() -> 'None':
948948
'the page no longer states the ruling as its headline, so a '
949949
'later mention of quiet=True is doing the work of pinning it')
950950

951-
def test_the_two_redundant_overrides_are_gone(self) -> 'None':
951+
def test_the_mh_helpers_define_no_get_override(self) -> 'None':
952952
"""#940: the owner ruled for deleting the redundant overrides, not widening them.
953953
954954
Several things at once, because the ruling is only settled if they all hold:
@@ -1200,14 +1200,14 @@ def test_the_extras_reader_agrees_with_tomllib(self) -> 'None':
12001200
'requirement string and a comment containing "]" are the two '
12011201
'shapes that broke it before')
12021202

1203-
def test_the_all_extra_is_exactly_the_three_core_addon_extras(self) -> 'None':
1203+
def test_the_all_extra_is_exactly_the_core_addon_extras(self) -> 'None':
12041204
"""``all`` carries core addons only, and the page's listing says what it is.
12051205
12061206
Two halves, because either can rot without the other. The tree half asks
1207-
:file:`pyproject.toml` whether ``all`` is still the union of ``cli``,
1207+
:file:`pyproject.toml` whether ``all`` is the union of ``cli``,
12081208
``crypto`` and ``NGAP`` and nothing else -- the shape GitHub issue #910's
12091209
ruling produced, narrowed to the core addons. The page half asks whether
1210-
the ``toml`` block on the page still shows that same list, since a page that
1210+
the ``toml`` block on the page shows that same list, since a page that
12111211
prints a stale ``all =`` line is worse than one that prints none.
12121212
12131213
"""
@@ -1216,14 +1216,14 @@ def test_the_all_extra_is_exactly_the_three_core_addon_extras(self) -> 'None':
12161216
core = [requirement for extra in ('cli', 'crypto', 'NGAP')
12171217
for requirement in extras[extra]]
12181218
self.assertEqual(sorted(extras['all']), sorted(core),
1219-
f"all is {extras['all']!r}, which is no longer the union of "
1219+
f"all is {extras['all']!r}, which is not the union of "
12201220
f'cli/crypto/NGAP {core!r} -- #910 narrowed it to the core '
12211221
'addons, so a change here is a change to that ruling')
12221222

12231223
# The page prints the literal list, so the literal list is what is checked.
12241224
listing = 'all = [ ' + ', '.join(f'"{req}"' for req in extras['all']) + ' ]'
12251225
self.assertIn(listing, _page(self.ANCHOR),
1226-
f'process.rst no longer shows {listing!r}; its toml block has '
1226+
f'process.rst does not show {listing!r}; its toml block has '
12271227
"drifted from pyproject.toml's own all extra")
12281228

12291229
def test_the_page_keeps_the_engine_and_installability_exclusions_apart(self) -> 'None':

‎tests/project/test_docs_internal_refs_1940_unit.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_documented_functions_have_docstrings(self) -> 'None':
250250
class ConvertedReferenceTests(unittest.TestCase):
251251
"""Each curated reference is a role, not a literal."""
252252

253-
def test_literal_is_now_a_role(self) -> 'None':
253+
def test_each_curated_reference_is_a_role_not_a_literal(self) -> 'None':
254254
for source, literal, role in CONVERTED:
255255
with self.subTest(source=source, literal=literal):
256256
text = (ROOT / source).read_text(encoding='utf-8')

‎tests/project/test_unit_tests_queue.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def test_the_step_runs_the_script_in_a_checkout(self) -> None:
288288
class TestJobGating(unittest.TestCase):
289289
"""Which jobs run on which events, read off their job-level keys."""
290290

291-
def test_the_four_legs_skip_only_on_a_docs_only_diff(self) -> None:
291+
def test_each_leg_skips_only_on_a_docs_only_diff(self) -> None:
292292
"""Each leg is gated on ``changes`` by a job-level ``if:``."""
293293
for name in LEGS:
294294
with self.subTest(job=name):

‎tests/project/test_workflow_run_verdict.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def test_a_skipped_head_cannot_cascade_into_the_acting_job(self) -> None:
563563
self.assertTrue(condition.startswith('!cancelled() && '))
564564
self.assertTrue(evaluate_condition(condition, skipped))
565565

566-
def test_the_three_call_one_head(self) -> None:
566+
def test_every_acting_workflow_calls_one_head(self) -> None:
567567
"""#1967: one copy of the gate and the verdict, called the same way from each.
568568
569569
The ``head`` jobs differ in their ``name:`` alone, no acting workflow

0 commit comments

Comments
 (0)