From 7ceb58a18194b9a917d98ed329c08577f8897f9e Mon Sep 17 00:00:00 2001 From: Jarry Shaw Date: Mon, 26 Oct 2026 11:05:46 -0400 Subject: [PATCH] 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; a wrapped docstring citation of #2248's old test_formerly_attributed_vendor_block_ no_longer_mints, now test_an_attributed_vendor_block_does_not_mint; 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. --- tests/const/test_const_enum_no_mint.py | 6 +++--- ...test_const_method_value_lookup_908_unit.py | 11 +++++----- ...fields_numbers_port_option_no_mint_unit.py | 2 +- tests/foundation/registry/test_protocols.py | 4 ++-- tests/project/test_changelog_md.py | 2 +- tests/project/test_conventions_doc_claims.py | 20 +++++++++---------- .../test_docs_internal_refs_1940_unit.py | 2 +- tests/project/test_unit_tests_queue.py | 2 +- tests/project/test_workflow_run_verdict.py | 2 +- 9 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tests/const/test_const_enum_no_mint.py b/tests/const/test_const_enum_no_mint.py index e81134925f..f830773c36 100644 --- a/tests/const/test_const_enum_no_mint.py +++ b/tests/const/test_const_enum_no_mint.py @@ -1482,8 +1482,8 @@ class EtherTypeMixedMintTests(unittest.TestCase): Unassigned`` and the "Old Xerox Experimental..." row, and #775 converts every attributed vendor block (a real company's own name for its own code) too, so no branch mints -- ``EtherType(0x0888)`` resolves to an - unregistered ``Xyplex_0x0888``. :meth:`test_formerly_attributed_vendor_block_ - no_longer_mints` below pins that one named probe (``Xyplex``).""" + unregistered ``Xyplex_0x0888``. :meth:`test_an_attributed_vendor_block_does_not_mint` + below pins that one named probe (``Xyplex``).""" def setUp(self) -> None: reimport_once_per_class(self, restore=True) @@ -2046,7 +2046,7 @@ def test_method_get_unknown_does_not_mint(self) -> None: self.assertEqual(different_case, 'PYPCAPKIT860PROBE2') self.assertNotEqual(first, different_case) - def test_registered_lookups_are_still_unaffected(self) -> None: + def test_registered_words_resolve_to_their_registered_members(self) -> None: """A word IANA already assigned still resolves to the same, genuinely-registered, identical member every time -- this conversion only changes what happens for a word that is not one of diff --git a/tests/const/test_const_method_value_lookup_908_unit.py b/tests/const/test_const_method_value_lookup_908_unit.py index 46ae210095..c2fd8a1b36 100644 --- a/tests/const/test_const_method_value_lookup_908_unit.py +++ b/tests/const/test_const_method_value_lookup_908_unit.py @@ -126,7 +126,7 @@ def test_an_exact_name_match_still_wins_and_ignores_a_supplied_default(self) -> class PreservedBehaviourTests(unittest.TestCase): """The two settled behaviours the fix must not disturb.""" - def test_case_sensitivity_from_896_still_holds(self) -> None: + def test_get_matches_names_case_sensitively(self) -> None: """RFC 9110 Section 9.1, via GitHub issue #896: a name match is case-**sensitive**, so ``get('get')`` must not resolve to :attr:`Method.GET`. Fails against a naive fix that resolves ``key`` @@ -158,7 +158,7 @@ class DefaultSignatureTests(unittest.TestCase): rather than widening to the base's ``NO_DEFAULT`` sentinel -- see the module docstring's reasoning.""" - def test_default_still_names_the_unregistered_members_value(self) -> None: + def test_default_names_the_unregistered_members_value(self) -> None: """Omitted or ``None``, ``default`` uses ``key`` itself; supplied, it replaces the *value* of the freshly minted unregistered member -- 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: self.assertEqual(len(Method.__members__), before) - def test_get_is_now_a_classmethod_bound_the_same_way_for_callers(self) -> None: - """The ``staticmethod`` -> ``classmethod`` switch GitHub issue #908's - own correction required is invisible to a caller: ``Method.get('X')`` - binds identically either way.""" + def test_get_is_a_classmethod_that_binds_to_the_class(self) -> None: + """``get`` is a ``classmethod``, the shape GitHub issue #908's own + correction required, and ``Method.get('X')`` binds to the class.""" from pcapkit.const.http.method import Method self.assertIsInstance(inspect.getattr_static(Method, 'get'), classmethod) diff --git a/tests/corekit/test_fields_numbers_port_option_no_mint_unit.py b/tests/corekit/test_fields_numbers_port_option_no_mint_unit.py index 658da7a1f7..b725228ea2 100644 --- a/tests/corekit/test_fields_numbers_port_option_no_mint_unit.py +++ b/tests/corekit/test_fields_numbers_port_option_no_mint_unit.py @@ -233,7 +233,7 @@ def test_a_documented_span_still_mints_its_own_bounded_member(self) -> None: self.assertEqual(resolved.svc, 'reserved') self.assertEqual(resolved.port, 230) - def test_an_out_of_width_port_still_raises_764s_rejection(self) -> None: + def test_an_out_of_width_port_raises_while_an_unassigned_one_resolves(self) -> None: """The bounded fallback must not revert GitHub pull request #764. ``post_process`` is reachable directly -- not only through ``unpack``, diff --git a/tests/foundation/registry/test_protocols.py b/tests/foundation/registry/test_protocols.py index fd4aeba17d..4ad2e983a7 100644 --- a/tests/foundation/registry/test_protocols.py +++ b/tests/foundation/registry/test_protocols.py @@ -179,7 +179,7 @@ def test_register_protocol_stays_quiet_when_nothing_is_displaced(self) -> None: """A fresh key and an identical re-registration are both silent. The code-keyed siblings share this identity guard too (#718) -- see - ``test_sibling_registries_now_stay_quiet_on_an_identical_re_registration`` in + ``test_sibling_registries_stay_quiet_on_an_identical_re_registration`` in this file. Here the key is *derived* from the class rather than supplied by the caller, and this function is the funnel every wrapper registrar ends in, 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: self.assertIs(udp_registry[udp_port], UnitProtocol) self.assertEqual(self._registry_warnings(caught, RegistryWarning), []) - def test_sibling_registries_now_stay_quiet_on_an_identical_re_registration(self) -> None: + def test_sibling_registries_stay_quiet_on_an_identical_re_registration(self) -> None: """GitHub issue #718: the siblings share ``register_protocol``'s guard. A repeat registration naming the exact same class stays silent, exactly diff --git a/tests/project/test_changelog_md.py b/tests/project/test_changelog_md.py index 5e98c543ee..151afaf20a 100644 --- a/tests/project/test_changelog_md.py +++ b/tests/project/test_changelog_md.py @@ -604,7 +604,7 @@ def test_a_sub_heading_underline_joined_into_the_prose_is_fatal(self) -> None: self._reject('\nA sub heading\n^^^^^^^^^^^^^\n\nSome prose.\n', 'setext underline joined') - def test_the_two_new_sub_heading_levels_become_atx_headings(self) -> None: + def test_dash_and_tilde_sub_headings_become_atx_headings(self) -> None: # The other half: ``-`` and ``~`` *convert* rather than being rejected, one # ATX level deeper each, so that the by-module sections and their # Added/Changed/Fixed subsections survive into ``CHANGELOG.md``. Against a diff --git a/tests/project/test_conventions_doc_claims.py b/tests/project/test_conventions_doc_claims.py index b3fb870275..dcd0e46cde 100644 --- a/tests/project/test_conventions_doc_claims.py +++ b/tests/project/test_conventions_doc_claims.py @@ -786,7 +786,7 @@ def test_a_delegating_override_is_a_classmethod(self) -> 'None': # so it is a live failure mode rather than a hypothetical one. The KeyError # fails the test either way, so nothing regressed silently; what it does not do # is say *which* class stopped defining `get`, or that the page is then wrong to - # list it. The sibling at `test_the_two_redundant_overrides_are_gone` already + # list it. The sibling at `test_the_mh_helpers_define_no_get_override` already # does this the right way round, with `assertNotIn('get', vars(klass))`. # Deliberately *not* under `subTest`: a subTest records its failure and lets # the method run on, so the bare `KeyError` this guard exists to pre-empt @@ -794,7 +794,7 @@ def test_a_delegating_override_is_a_classmethod(self) -> 'None': # plain assertion aborts here, which is the whole point. for klass in (Method, Command, OptionType): self.assertIn('get', vars(klass), - f'{klass.__name__} no longer defines a get of its own, so ' + f'{klass.__name__} defines no get of its own, so ' 'the page is wrong to name it among the overrides -- an ' 'override folded into the inherited base is what #940 did ' 'to the mh/ngap helpers') @@ -809,8 +809,8 @@ def test_a_delegating_override_is_a_classmethod(self) -> 'None': 'followed it') self.assertIn('return super().get(key)', inspect.getsource(vars(klass)['get'].__func__), - f'{klass.__name__}.get no longer delegates, so the page is ' - 'wrong to give it as a delegating override') + f'{klass.__name__}.get does not delegate to super().get(key), ' + 'so the page is wrong to give it as a delegating override') self.assertIsInstance(vars(OptionType)['get'], staticmethod) self.assertNotIn('super()', inspect.getsource(vars(OptionType)['get'].__func__), 'OptionType.get delegates to super(), so the page is wrong to list it ' @@ -948,7 +948,7 @@ def _restore() -> 'None': 'the page no longer states the ruling as its headline, so a ' 'later mention of quiet=True is doing the work of pinning it') - def test_the_two_redundant_overrides_are_gone(self) -> 'None': + def test_the_mh_helpers_define_no_get_override(self) -> 'None': """#940: the owner ruled for deleting the redundant overrides, not widening them. 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': 'requirement string and a comment containing "]" are the two ' 'shapes that broke it before') - def test_the_all_extra_is_exactly_the_three_core_addon_extras(self) -> 'None': + def test_the_all_extra_is_exactly_the_core_addon_extras(self) -> 'None': """``all`` carries core addons only, and the page's listing says what it is. Two halves, because either can rot without the other. The tree half asks - :file:`pyproject.toml` whether ``all`` is still the union of ``cli``, + :file:`pyproject.toml` whether ``all`` is the union of ``cli``, ``crypto`` and ``NGAP`` and nothing else -- the shape GitHub issue #910's ruling produced, narrowed to the core addons. The page half asks whether - the ``toml`` block on the page still shows that same list, since a page that + the ``toml`` block on the page shows that same list, since a page that prints a stale ``all =`` line is worse than one that prints none. """ @@ -1216,14 +1216,14 @@ def test_the_all_extra_is_exactly_the_three_core_addon_extras(self) -> 'None': core = [requirement for extra in ('cli', 'crypto', 'NGAP') for requirement in extras[extra]] self.assertEqual(sorted(extras['all']), sorted(core), - f"all is {extras['all']!r}, which is no longer the union of " + f"all is {extras['all']!r}, which is not the union of " f'cli/crypto/NGAP {core!r} -- #910 narrowed it to the core ' 'addons, so a change here is a change to that ruling') # The page prints the literal list, so the literal list is what is checked. listing = 'all = [ ' + ', '.join(f'"{req}"' for req in extras['all']) + ' ]' self.assertIn(listing, _page(self.ANCHOR), - f'process.rst no longer shows {listing!r}; its toml block has ' + f'process.rst does not show {listing!r}; its toml block has ' "drifted from pyproject.toml's own all extra") def test_the_page_keeps_the_engine_and_installability_exclusions_apart(self) -> 'None': diff --git a/tests/project/test_docs_internal_refs_1940_unit.py b/tests/project/test_docs_internal_refs_1940_unit.py index 5f2ba82ec3..a4ab682eeb 100644 --- a/tests/project/test_docs_internal_refs_1940_unit.py +++ b/tests/project/test_docs_internal_refs_1940_unit.py @@ -250,7 +250,7 @@ def test_documented_functions_have_docstrings(self) -> 'None': class ConvertedReferenceTests(unittest.TestCase): """Each curated reference is a role, not a literal.""" - def test_literal_is_now_a_role(self) -> 'None': + def test_each_curated_reference_is_a_role_not_a_literal(self) -> 'None': for source, literal, role in CONVERTED: with self.subTest(source=source, literal=literal): text = (ROOT / source).read_text(encoding='utf-8') diff --git a/tests/project/test_unit_tests_queue.py b/tests/project/test_unit_tests_queue.py index c48355f59b..16e5d2761e 100644 --- a/tests/project/test_unit_tests_queue.py +++ b/tests/project/test_unit_tests_queue.py @@ -288,7 +288,7 @@ def test_the_step_runs_the_script_in_a_checkout(self) -> None: class TestJobGating(unittest.TestCase): """Which jobs run on which events, read off their job-level keys.""" - def test_the_four_legs_skip_only_on_a_docs_only_diff(self) -> None: + def test_each_leg_skips_only_on_a_docs_only_diff(self) -> None: """Each leg is gated on ``changes`` by a job-level ``if:``.""" for name in LEGS: with self.subTest(job=name): diff --git a/tests/project/test_workflow_run_verdict.py b/tests/project/test_workflow_run_verdict.py index 93dc4a12f2..70033b8733 100644 --- a/tests/project/test_workflow_run_verdict.py +++ b/tests/project/test_workflow_run_verdict.py @@ -563,7 +563,7 @@ def test_a_skipped_head_cannot_cascade_into_the_acting_job(self) -> None: self.assertTrue(condition.startswith('!cancelled() && ')) self.assertTrue(evaluate_condition(condition, skipped)) - def test_the_three_call_one_head(self) -> None: + def test_every_acting_workflow_calls_one_head(self) -> None: """#1967: one copy of the gate and the verdict, called the same way from each. The ``head`` jobs differ in their ``name:`` alone, no acting workflow