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 pcapkit/foundation/registry/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class rather than supplied by a caller, and this function is the funnel
if not isinstance(protocol, type):
raise RegistryError(f'protocol must be a class, not {protocol!r}')
if not issubclass(protocol, ProtocolBase):
raise RegistryError(f'protocol must be a Protocol subclass, not {protocol!r}')
raise RegistryError(f'protocol must be a ProtocolBase subclass, not {protocol!r}')

name = protocol.__name__.upper()
incumbent = protocol_registry.get(name)
Expand Down
2 changes: 1 addition & 1 deletion pcapkit/protocols/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def _next_layer_entry(cls, code: 'Any', protocol: 'ModuleDescriptor[ProtocolBase
if not isinstance(protocol, type):
raise RegistryError(f'protocol must be a class, not {protocol!r}')
if not issubclass(protocol, ProtocolBase):
raise RegistryError(f'protocol must be a Protocol subclass, not {protocol!r}')
raise RegistryError(f'protocol must be a ProtocolBase subclass, not {protocol!r}')
return protocol

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions tests/foundation/reassembly/test_deferred_pickle_2423_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ def test_setstate_accepts_the_native_default_shape(self) -> None:
def test_setstate_still_accepts_the_first_revisions_flat_shape(self) -> None:
"""The flat ``{slot: value}`` shape the very first fix returned.

Never released, but already pushed to this pull request's earlier
commit -- accepting it costs nothing and protects anyone who
pickled against that commit.
Never released, but already pushed in an earlier revision of
:issue:`2424`'s fix -- accepting it costs nothing and protects anyone
who pickled against that revision.

"""
from pcapkit.foundation.reassembly.data.data import Deferred
Expand Down
2 changes: 1 addition & 1 deletion tests/foundation/registry/test_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def test_register_protocol_rejects_a_non_class_with_registry_error(self) -> None
('none', None, 'must be a class'),
('descriptor argument (not unwrapped here)',
ModuleDescriptor('pcapkit.protocols.misc.raw', 'Raw'), 'must be a class'),
('wrong class', object, 'Protocol subclass'),
('wrong class', object, 'ProtocolBase subclass'),
):
with self.subTest(value=label):
with self.assertRaises(RegistryError) as caught:
Expand Down
4 changes: 2 additions & 2 deletions tests/protocols/test_register_class_guard_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_wrong_class_still_raises_registry_error(self) -> None:
with mock.patch.dict(klass.__proto__):
with self.assertRaises(RegistryError) as caught:
klass.register(code, dict) # type: ignore[arg-type]
self.assertIn('Protocol subclass', str(caught.exception))
self.assertIn('ProtocolBase subclass', str(caught.exception))

def test_descriptor_naming_a_non_class_raises_registry_error(self) -> None:
from pcapkit.corekit.module import ModuleDescriptor
Expand All @@ -107,7 +107,7 @@ def test_descriptor_naming_a_wrong_class_still_raises_registry_error(self) -> No
with mock.patch.dict(klass.__proto__):
with self.assertRaises(RegistryError) as caught:
klass.register(code, descriptor) # type: ignore[arg-type]
self.assertIn('Protocol subclass', str(caught.exception))
self.assertIn('ProtocolBase subclass', str(caught.exception))

def test_valid_class_and_descriptor_still_register(self) -> None:
from pcapkit.corekit.module import ModuleDescriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
exactly ``kind`` and ``length`` (#541) and every concrete subtype adds its own on top; none of
them declares ``option``, under :data:`~typing.TYPE_CHECKING` or otherwise. So the assignment
created an attribute out of nothing at unpack time, and nothing in ``pcapkit`` read it back:
``kind``, a real :class:`~pcapkit.corekit.fields.enums.EnumField`, already carries
``kind``, a real :class:`~pcapkit.corekit.fields.numbers.EnumField`, already carries
:attr:`~pcapkit.const.tcp.option.Option.Multipath_TCP`, and it is ``kind`` that the schema
packs.

Expand Down
Loading