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 ProtocolBase subclass, not {protocol!r}')
raise RegistryError(f'protocol must be a Protocol 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 ProtocolBase subclass, not {protocol!r}')
raise RegistryError(f'protocol must be a Protocol subclass, not {protocol!r}')
return protocol

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ 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 in an earlier revision of
:issue:`2424`'s fix -- accepting it costs nothing and protects anyone
:issue:`2423`'s fix -- accepting it costs nothing and protects anyone
who pickled against that revision.

"""
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, 'ProtocolBase subclass'),
('wrong class', object, 'Protocol 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('ProtocolBase subclass', str(caught.exception))
self.assertIn('Protocol 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('ProtocolBase subclass', str(caught.exception))
self.assertIn('Protocol subclass', str(caught.exception))

def test_valid_class_and_descriptor_still_register(self) -> None:
from pcapkit.corekit.module import ModuleDescriptor
Expand Down
Loading