Skip to content

Commit a36a340

Browse files
authored
test(hip): drop counted numbers from the #2394 str-name test (#2402)
test_hip_list_argument_str_names_2394_unit.py stated counts of the HIP makers it covers ("twelve", "thirteenth", "five") in prose, and pinned len(found) == 12 as an assertion -- both forbidden by the project's state-no-count convention (docs/source/contributing/conventions/ documentation.rst), which extends to count pins and the tests that check them, not just narrative docs. Found by #2401's own cross-review, which landed after that PR had already merged. Reworded the 8 affected lines to describe shape rather than count (e.g. "every one of them" rather than "all twelve"). Dropped the len(found) count assertion: it was redundant with the adjacent assertEqual(found, set(CASES)), whose set equality already forces the same length check, with a named maker in the failure message, and without a number that goes stale the moment a 13th site is added. No behavior change; 7 passed / 17 subtests, same as before.
1 parent 28c43c9 commit a36a340

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

‎tests/protocols/internet/test_hip_list_argument_str_names_2394_unit.py‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
enumeration member resolves a name on its own, and one whose default is
99
:data:`None` has nothing to read.
1010
11-
Twelve HIP parameters carry a *list* of enumeration values rather than one, and
11+
Some HIP parameters carry a *list* of enumeration values rather than one, and
1212
build it in a loop. The value handed to ``_make_index`` is therefore the loop
1313
variable, which is no argument of the maker at all, so the inference cannot
1414
reach the list argument's annotation and a name goes unresolved however the
1515
list argument is declared. Measured before the fix: the member and integer
16-
forms of each of these twelve built the correct octets, and the member-name
16+
forms of every one of them built the correct octets, and the member-name
1717
form raised ``ProtocolNotImplemented: protocol 'RENDEZVOUS' not implemented``.
1818
Each maker now names its own enumeration, which is what #2393 did for the
1919
scalar case -- just ahead of the loop rather than at the call, so that the
2020
decision is taken once per parameter instead of once per item.
2121
2222
:meth:`HIPListArgumentStrNameTests.test_every_list_argument_maker_has_a_case`
2323
reads the loop-variable sites off ``hip.py`` itself rather than trusting the
24-
list of twelve, so a thirteenth parameter added with the same shape cannot land
24+
list below, so a further parameter added with the same shape cannot land
2525
without a case here.
2626
2727
Every case builds its own packet in memory and reads no capture. :class:`HIP`
@@ -54,7 +54,7 @@
5454

5555
#: HIP version each version-bound parameter demands: ``HIP_TRANSFORM`` (577) is
5656
#: :rfc:`5201` only, as :data:`examples.generators.options.HIP_VERSION` records,
57-
#: and the rest of the twelve are refused at version 1 or indifferent to it.
57+
#: and the rest are refused at version 1 or indifferent to it.
5858
HIP_VERSION = {577: 1}
5959

6060
#: One case per maker: ``{maker: (parameter name, list keyword, enum module and
@@ -96,7 +96,7 @@
9696
'_make_param_reg_failed': (
9797
'REG_FAILED', 'reg_failed', 'pcapkit.const.hip.registration.Registration',
9898
'RENDEZVOUS', {'failure_type': 1}),
99-
# The only one of the twelve whose list holds parameter codes rather than a
99+
# The only one of these whose list holds parameter codes rather than a
100100
# namespace of its own, so its enumeration is the same ``Parameter`` the
101101
# ``code`` argument carries.
102102
'_make_param_transport_format_list': (
@@ -160,9 +160,9 @@ def _build(code: 'object', value: 'object') -> 'bytes':
160160
def test_a_member_name_in_a_list_builds_what_the_member_builds(self) -> None:
161161
"""#2394: the three forms of a list item agree, octet for octet.
162162
163-
The member-name form raised ``ProtocolNotImplemented`` for all twelve
164-
before the fix, while the member and integer forms built these very
165-
octets, so this is the fail-without-fix assertion and the
163+
The member-name form raised ``ProtocolNotImplemented`` for every maker
164+
in ``CASES`` before the fix, while the member and integer forms built
165+
these very octets, so this is the fail-without-fix assertion and the
166166
no-regression one at once.
167167
168168
"""
@@ -276,7 +276,7 @@ def test_every_list_argument_maker_has_a_case(self) -> None:
276276
property of the *shape* of the call: the value handed to
277277
:meth:`~pcapkit.protocols.protocol.ProtocolBase._make_index` is a name
278278
that is not an argument of the maker, so nothing is there for the
279-
namespace to be inferred from. A thirteenth parameter of that shape
279+
namespace to be inferred from. A further parameter of that shape
280280
would be broken in exactly the same way and is caught here.
281281
282282
"""
@@ -302,10 +302,9 @@ def test_every_list_argument_maker_has_a_case(self) -> None:
302302
self.assertEqual(found, set(CASES),
303303
'a HIP maker resolves a name that is not one of its own '
304304
'arguments and has no case in CASES (#2394)')
305-
self.assertEqual(len(found), 12)
306305

307306
def test_the_named_enumerations_are_imported_at_runtime(self) -> None:
308-
"""#2394: the five enumerations the fix needs are no longer type-only.
307+
"""#2394: the enumerations the fix needs are no longer type-only.
309308
310309
``Suite``, ``NATTraversal``, ``Registration``, ``ESPTransformSuite`` and
311310
``Transport`` were imported under ``TYPE_CHECKING`` alone, which is why

0 commit comments

Comments
 (0)