Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def restore_module_table() -> 'Iterator[None]':
:class:`~typing.Generic` stayed bound after the test that installed it, and
the next test to import :mod:`pcapkit` died on ``TypeError: type
'ProtocolBase' is not subscriptable`` at
``pcapkit/protocols/misc/pcap/frame.py:61`` -- twelve tests in
``pcapkit/protocols/misc/pcap/frame.py:69`` -- twelve tests in
:mod:`tests.project`, and only when the polluting file happened to be
collected first. Three separate files turned out to leak this way, one of
which -- :mod:`tests.cli.test_main` -- did not import :mod:`tests._support`
Expand Down
2 changes: 1 addition & 1 deletion tests/const/test_const_ftp_featcode_case_903_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def test_tls_key_label_stays_case_sensitive(self) -> 'None':

def test_command_keeps_its_own_rfc_959_fold(self) -> 'None':
""":class:`~pcapkit.const.ftp.command.Command` shares this module and
folds for a different reason -- RFC 959 Section 4.1's *"Upper and
folds for a different reason -- RFC 959 Section 5.3's *"Upper and
lower case alphabetic characters are to be treated identically"* --
so it must be unaffected by the sibling class changing."""
self.assertIs(Command.get('RETR'), Command.RETR) # type: ignore[attr-defined]
Expand Down
4 changes: 2 additions & 2 deletions tests/const/test_const_method_case_sensitive_896_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
non-standardised method from the registered ``GET`` -- conflating the two
was the defect. Contrast :class:`~pcapkit.const.ftp.command.Command`'s own
equivalent override, which stays case-insensitive deliberately: RFC 959
Section 4.1 says FTP's four-letter command codes *are* to be treated
Section 5.3 says FTP's four-letter command codes *are* to be treated
identically regardless of case, so ``Command.get`` is untouched by this
issue and is repinned below (:meth:`MethodGetCaseSensitivityTests.
test_command_get_stays_case_insensitive`) so a future change cannot quietly
Expand Down Expand Up @@ -212,7 +212,7 @@ def test_unregistered_member_preserves_the_callers_casing(self) -> None:
def test_command_get_stays_case_insensitive(self) -> None:
"""The registry #896 explicitly leaves alone.

RFC 959 Section 4.1: FTP command codes are to be treated
RFC 959 Section 5.3: FTP command codes are to be treated
identically regardless of case, so
:meth:`~pcapkit.const.ftp.command.Command.get` keeps folding case --
pinned here so a future edit to the sibling ``Method`` fix cannot
Expand Down
4 changes: 2 additions & 2 deletions tests/corekit/test_fields_copy_dispatch_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def assertCallReachesCopyDunderOnly(self, field: 'FieldBase[Any]') -> None:
self.assertIsInstance(new_field, type(field))

def test_field_base_call_field_py_294(self) -> None:
""":meth:`FieldBase.__call__` (``field.py:281``), reached via :class:`NoValueField`.
""":meth:`FieldBase.__call__` (``field.py:274``), reached via :class:`NoValueField`.

:class:`~pcapkit.corekit.fields.misc.NoValueField` is the one concrete
class in this package that never overrides ``__call__``, so it is the
Expand All @@ -98,7 +98,7 @@ class in this package that never overrides ``__call__``, so it is the
self.assertCallReachesCopyDunderOnly(NoValueField())

def test_field_call_field_py_579(self) -> None:
""":meth:`Field.__call__` (``field.py:581``)."""
""":meth:`Field.__call__` (``field.py:580``)."""
from pcapkit.corekit.fields.field import Field

self.assertCallReachesCopyDunderOnly(Field(length=4))
Expand Down
2 changes: 1 addition & 1 deletion tests/corekit/test_fields_misc_packet_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_nested_schema_reads_enclosing_field_by_name_and_does_not_leak_writes(se
def test_pcapng_byteorder_consumer_still_works_with_both_shapes(self) -> None:
"""The one existing, hand-rolled ``__packet__`` fallback is unaffected.

``packet_byteorder`` (``pcapkit/corekit/fields/byteorder.py:28``)
``packet_byteorder`` (``pcapkit/corekit/fields/byteorder.py:33``)
is called both with a plain dict built by hand -- as several tests and
:func:`~pcapkit.foundation.engines.pcapng` construct -- and with what
``SchemaField`` now actually builds. Both must keep working, and
Expand Down
2 changes: 1 addition & 1 deletion tests/project/test_module_isolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
three in the opposite order gave ``17 passed``. The cause was a test that bound a
non-generic ``ProtocolBase`` stand-in into :data:`sys.modules` and finished
without removing it, so the next test to import :mod:`pcapkit` died at
``pcapkit/protocols/misc/pcap/frame.py:61`` with ``TypeError: type 'ProtocolBase'
``pcapkit/protocols/misc/pcap/frame.py:69`` with ``TypeError: type 'ProtocolBase'
is not subscriptable``.

The tests here run :program:`pytest` in a subprocess over the exact selections
Expand Down
2 changes: 1 addition & 1 deletion tests/project/test_release_gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2722,7 +2722,7 @@ class TestGateMutationsChangeTheTruthTable(WorkflowMixin, unittest.TestCase):
#: mutations have to be the *small* edits a review round produces -- a
#: regenerated condition would differ in ways nobody would have typed.
#:
#: The first eight are the mutations #962 names; the next five are this
#: The first eight are the mutations #962 names; the next six are this
#: module's own, covering the clauses the issue only points at -- the
#: publishing predecessors' equality pair, the ``startsWith``
#: short-circuit, and reading somebody else's evidence. The ``!= 'true'``
Expand Down
2 changes: 1 addition & 1 deletion tests/project/test_rfc_anchor_fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
test exists to catch, the same mistake as the allowlist above one layer down.
The generators that produce them,
:file:`pcapkit/vendor/tcp/mp_tcp_option.py:59` and
:file:`pcapkit/vendor/reg/apptype/apptype.py:1148` (both parsing IANA's
:file:`pcapkit/vendor/reg/apptype/apptype.py:1169` (both parsing IANA's
``RFC8684, Section 3.1`` with the same ``re.fullmatch(r'RFC(?P<rfc>\\d+)(, Section
(?P<sec>.*?))?', ...)``, which discards the literal word ``Section`` and
keeps only the number), are fixed to emit ``#section-{sec}``, and the ten
Expand Down
10 changes: 6 additions & 4 deletions tests/protocols/application/test_http_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ def test_http_construction_reaches_the_versioned_make_callee(self) -> None:
``protocol.make(**kwargs)`` dispatch this issue is actually about.

The real, supported entry point is construction:
:meth:`ProtocolBase.__init__` (``protocol.py:1146``, the ``**kwargs``-
only overload at ``:1144``) calls ``self.pack(**kwargs)`` when built
with no ``file``, and :meth:`ProtocolBase.pack` (``protocol.py:750``)
is ``self.__header__ = self.make(**kwargs)`` -- a *bound* call on the
:meth:`ProtocolBase.__init__` (``protocol.py:1203``, the ``**kwargs``-
only overload at ``:1201``) calls ``self.pack(**kwargs)``, through
:meth:`~ProtocolBase.__post_init__`, when built with no ``file``, and
:meth:`ProtocolBase.pack` (``protocol.py:761``) calls
``target.make(**kwargs)`` on :meth:`~ProtocolBase._packing_target`,
which while constructing is the instance itself -- a *bound* call on the
outer ``HTTP`` instance, which is what actually reaches the inner,
previously-unbound ``protocol.make(**kwargs)``. So the reachable
reproduction is ``HTTP(version=1, ...)``, not ``HTTP.make(...)``:
Expand Down
2 changes: 1 addition & 1 deletion tests/protocols/internet/test_ipv6_ext_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def test_every_subclass_index_returns_a_real_transtype(self) -> None:
def test_every_subclass_alias_survives_the_packet_dict_key_computation(self) -> None:
""":meth:`IPv6._decode_next_layer
<pcapkit.protocols.internet.ipv6.IPv6._decode_next_layer>` keys its
packet dict by ``alias.lstrip('IPv6-').lower()`` (``ipv6.py:436``, in ``_exthdr_key``).
packet dict by ``alias.lstrip('IPv6-').lower()`` (``ipv6.py:455``, in ``_exthdr_key``).
:meth:`str.lstrip` strips a character *set*, so the hyphen in
``IPv6-Route``/``IPv6-Frag``/``IPv6-Opts`` is what lets ``IPv6`` fall
away cleanly, where the underscore of a class-name default like
Expand Down
2 changes: 1 addition & 1 deletion tests/protocols/internet/test_mh_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ def wrap_in_ipv4(mh_payload: bytes) -> IPv4:
with self.subTest('over IPv6, the raise now costs only the MH slot (GitHub issue #891)'):
# Mobility Header is *also* one of IPv6's own chained extension
# headers (``Enum_ExtensionHeader.Mobility_Header``, value 135 --
# ``pcapkit/const/ipv6/extension_header.py:42``), so IPv6 never
# ``pcapkit/const/ipv6/extension_header.py:49``), so IPv6 never
# reaches the fallback through the base ``_import_next_layer`` at
# all -- it walks its own ``@beholder``-decorated override
# (``pcapkit/protocols/internet/ipv6.py:_import_next_layer``).
Expand Down
2 changes: 1 addition & 1 deletion tests/protocols/misc/test_pcapng_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ def test_tls_key_label_tracks_rfc_9850_plus_documented_rsa_exception(self) -> No

# Every member's value pinned exactly -- this is a value-matched
# registry (``TLSKeyLabel(label.upper())`` at
# pcapkit/protocols/schema/misc/pcapng.py:2243), so the value, not
# pcapkit/protocols/schema/misc/pcapng.py:2249), so the value, not
# merely the name, is what callers depend on.
for name in expected:
with self.subTest(name=name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def test_the_pcapng_1248_symptom_no_longer_reproduces(self) -> None:
:meth:`NameResolutionBlock.post_process
<pcapkit.protocols.schema.misc.pcapng.NameResolutionBlock.post_process>`
asks ``isinstance(record, (IPv4Record, IPv6Record))`` at
:file:`pcapkit/protocols/schema/misc/pcapng.py:1870` and then reads
:file:`pcapkit/protocols/schema/misc/pcapng.py:1876` and then reads
``record.names``. Before #439 was fixed, every schema class shared one
``_abc_impl``, so that question answered ``True`` for the block's
*terminating* ``EndRecord`` -- which has no ``names`` -- provided
Expand Down
8 changes: 4 additions & 4 deletions tests/protocols/test_construction_keyword_check_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ def test_the_exception_is_the_one_the_library_already_uses(self) -> None:
Not a new exception type: the library already answers "you passed a
keyword I do not accept" with
:exc:`~pcapkit.utilities.exceptions.UnsupportedCall`, in five places with
this exact message shape -- ``protocol.py:1412``,
``dumpkit/common.py:168``, ``foundation/reassembly/reassembly.py:587``,
``foundation/engines/engine.py:314`` and
``foundation/traceflow/traceflow.py:555``. Reusing it keeps one answer to
this exact message shape -- ``protocol.py:1469``,
``dumpkit/common.py:169``, ``foundation/reassembly/reassembly.py:594``,
``foundation/engines/engine.py:321`` and
``foundation/traceflow/traceflow.py:563``. Reusing it keeps one answer to
one question rather than adding a second.

The honest caveat, recorded so it is a decision rather than an oversight:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

The parse path has the identical pair of branches in ``_read_mptcp_join`` and is fine,
because :meth:`~pcapkit.protocols.transport.tcp.TCP.read` assigns ``self._flags`` at
``tcp.py:510``, before it parses the options at ``tcp.py:530``. Only the make path was
``tcp.py:535``, before it parses the options at ``tcp.py:555``. Only the make path was
inverted.

The fix is the hoist: the ``flags`` dict and the ``_flag`` accumulation move above the
Expand Down Expand Up @@ -552,7 +552,7 @@ def test_make_re_derives_the_flags_on_every_call(self) -> None:

Adding an ``options`` argument would not turn this into a discriminator, which is
worth recording since it is the obvious thing to try. Pre-fix, ``make`` assigned
``self._flags`` *after* building the options -- so by the time ``pack`` returned,
``self._flags`` *after* building the options -- so by the time ``make`` returned,
the attribute held the new call's flags either way, and only the option octets
built in between were wrong. The assertion that separates the two trees is
therefore on those octets, and
Expand Down
2 changes: 1 addition & 1 deletion tests/test_support_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def test_protochain_leaves_no_fake_protocol_module_behind(self) -> None:
def test_the_real_protocol_base_still_subscripts_afterwards(self) -> None:
"""The failure mode itself, rather than the table it came from.

``pcapkit/protocols/misc/pcap/frame.py:61`` is the line that raised
``pcapkit/protocols/misc/pcap/frame.py:69`` is the line that raised
``TypeError: type 'ProtocolBase' is not subscriptable``, so importing it
after the polluting test case has run is the most direct statement of
what #660 was.
Expand Down
4 changes: 2 additions & 2 deletions tests/vendor/test_crawler_reachability_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

.. code-block:: python

# pcapkit/vendor/__main__.py:230, the `--target <name>` path
# pcapkit/vendor/__main__.py:228, the `--target <name>` path
target_list.extend(getattr(module, name) for name in module.__all__)
# pcapkit/vendor/__main__.py:238, the default path, i.e. a bare `pcapkit-vendor`
# pcapkit/vendor/__main__.py:236, the default path, i.e. a bare `pcapkit-vendor`
target_list.extend(getattr(vendor_module, name) for name in vendor_module.__all__)

:attr:`pcapkit.vendor.__all__` listed ``'MH_HandoverACKStatus'`` *twice* and had
Expand Down
Loading