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
112 changes: 55 additions & 57 deletions tests/const/test_const_enum_no_mint.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,21 @@
raise. None of the tests below pin that, per the same ruling.

GitHub issue #775's final round closes the two mixed registries themselves:
every one of :class:`~pcapkit.const.reg.ethertype.EtherType`'s 52 still-
minting range branches, and :class:`~pcapkit.const.ipx.socket.Socket`'s one
(``Registered by Xerox``), now convert to :meth:`~pcapkit.corekit.enum.
EnumRegistry._unregistered_member` too -- PR #878 scoped the change this way:
preserve each branch's existing name argument exactly as the current code
produces it, since this is about not registering rather than about renaming
anything. So each keeps the hex-suffixed name it always rendered
(``Xyplex_0x0888``, not a bare ``Xyplex``) even though it no longer
registers -- neither is "mixed" any more, both are wholly converted like the
82 in :data:`RULING_CONVERTED_REGISTRIES`, and :class:`EtherTypeMixedMintTests`
/:class:`IPXSocketMixedMintTests` below are retitled in place to prove the
formerly-kept probe no longer mints rather than that it still does. The one
consequence worth naming: this reintroduces the exact "manufactured,
value-suffixed name" shape :func:`is_manufactured` exists to flag, on calls
that are still safe because :meth:`_unregistered_member` never registers
regardless of what its ``name`` argument looks like -- see
every one of :class:`~pcapkit.const.reg.ethertype.EtherType`'s 52
still-minting range branches, and :class:`~pcapkit.const.ipx.socket.Socket`'s
one (``Registered by Xerox``), now convert to
:meth:`~pcapkit.corekit.enum.EnumRegistry._unregistered_member` too -- PR #878
scoped it this way: keeping the existing hex-suffixed name, since this change
is about not registering rather than renaming. So each keeps the hex-suffixed
name it always rendered (``Xyplex_0x0888``, not a bare ``Xyplex``) even though
it no longer registers -- neither is "mixed" any more, both are wholly
converted like the 82 in :data:`RULING_CONVERTED_REGISTRIES`, and
:class:`EtherTypeMixedMintTests`/:class:`IPXSocketMixedMintTests` below are
retitled in place to prove the formerly-kept probe no longer mints rather than
that it still does. The one consequence worth naming: this reintroduces the
exact "manufactured, value-suffixed name" shape :func:`is_manufactured` exists
to flag, on calls that are still safe because :meth:`_unregistered_member`
never registers regardless of what its ``name`` argument looks like -- see
:func:`_is_hex_suffixed_unregistered_name` in
:class:`UnregisteredMemberNameIsBareTests` for the scoped exemption this
required, keyed on the ``name`` argument's own shape rather than on the two
Expand Down Expand Up @@ -591,23 +590,24 @@ def _first_unassigned_value(cls: 'type') -> 'int':
0x8039: 'DEC_Unassigned',
0x0101: ETHERTYPE_OLD_XEROX_LABEL,
}
#: The one probe the original ruling held out as "a real ownership fact, keep
#: minting" -- Xyplex, 0x0888. #775's final round converts it too, preserving
#: The one probe the original ruling kept minting -- Xyplex, 0x0888 -- because
#: a proprietary protocol has no public name of its own, so the company name
#: serves as one (#775, #847). #775's final round converts it too, preserving
#: the hex-suffixed name exactly as the crawler always rendered it (PR #878
#: scoped it that way: preserving each branch's existing name argument
#: exactly as the current code produces it, since this is about not
#: registering rather than about renaming anything), so this now pins the
#: opposite of what its name suggests: that the formerly-kept probe no
#: longer mints either. Kept as its own constant, distinct from
#: :data:`ETHERTYPE_UNASSIGNED_PROBES`, because :class:`EtherTypeMixedMintTests`
#: below still wants it named individually in its own regression test.
#: scoped it this way: keeping the existing hex-suffixed name, since this
#: change is about not registering rather than renaming), so this now pins the
#: opposite of what its name suggests: that the formerly-kept probe no longer
#: mints either. Kept as its own constant, distinct from
#: :data:`ETHERTYPE_UNASSIGNED_PROBES`, because
#: :class:`EtherTypeMixedMintTests` below still wants it named individually in
#: its own regression test.
ETHERTYPE_FORMERLY_KEPT_PROBE = (0x0888, 'Xyplex_0x0888')

#: :class:`~pcapkit.const.ipx.socket.Socket` probes for the owner's original
#: #775/#847 ruling: ``Experimental`` and the three "who may claim this pool"
#: policy labels convert; ``Registered by Xerox`` -- a real ownership fact,
#: not a status word -- used to keep minting, pinned by
#: :data:`IPX_SOCKET_FORMERLY_KEPT_PROBE`.
#: #775/#847 ruling: ``Experimental`` and the three dynamically/statically
#: assigned labels convert, as notation for the reader rather than a final
#: concrete assigned name; ``Registered by Xerox``, the company one, used to
#: keep minting, pinned by :data:`IPX_SOCKET_FORMERLY_KEPT_PROBE`.
IPX_SOCKET_UNASSIGNED_PROBES = {
0x0025: 'Experimental',
0x4001: 'Dynamically Assigned Socket Numbers',
Expand Down Expand Up @@ -1293,21 +1293,21 @@ class UnregisteredMemberNameIsBareTests(unittest.TestCase):
all 52 of :class:`~pcapkit.const.reg.ethertype.EtherType`'s and
:class:`~pcapkit.const.ipx.socket.Socket`'s one -- and deliberately keeps
each one's hex-suffixed name unchanged (PR #878 scoped it this way:
preserving each branch's existing name argument exactly as the current
code produces it, since this is about not registering rather than
renaming anything). That is the exact manufactured, value-suffixed
shape :func:`is_manufactured` exists to flag -- unlike ``'%s_unknown' %
namespace`` above, the substituted operand here really is ``value``, via
``hex(value)[2:].upper().zfill(4)``. Flagging it anyway would be a false
positive in the sense that matters: the collision this check protects
against is two *minted* members sharing a name at different values, and
neither of these 53 calls ever mints, so nothing can collide regardless
of what the ``name`` argument looks like. :func:`_is_hex_suffixed_
unregistered_name` below is the scoped fix -- an exemption keyed on the
``name`` argument's own AST shape, not on which file the call lives in,
from the sweep only -- not a change to :func:`is_manufactured` itself,
which stays exactly as tested against :data:`IS_MANUFACTURED_FIXTURES`
and keeps flagging this shape everywhere else it might appear.
keeping the existing hex-suffixed name, since this change is about not
registering rather than renaming). That is the exact manufactured,
value-suffixed shape :func:`is_manufactured` exists to flag -- unlike
``'%s_unknown' % namespace`` above, the substituted operand here really is
``value``, via ``hex(value)[2:].upper().zfill(4)``. Flagging it anyway
would be a false positive in the sense that matters: the collision this
check protects against is two *minted* members sharing a name at different
values, and neither of these 53 calls ever mints, so nothing can collide
regardless of what the ``name`` argument looks like.
:func:`_is_hex_suffixed_unregistered_name` below is the scoped fix -- an
exemption keyed on the ``name`` argument's own AST shape, not on which
file the call lives in, from the sweep only -- not a change to
:func:`is_manufactured` itself, which stays exactly as tested against
:data:`IS_MANUFACTURED_FIXTURES` and keeps flagging this shape everywhere
else it might appear.

"""

Expand Down Expand Up @@ -1542,12 +1542,10 @@ def test_formerly_attributed_vendor_block_no_longer_mints(self) -> None:
exact probe (``Xyplex``, 0x0888) used to prove the ruling *kept*
minting a real attributed name; GitHub issue #775's final round
converts it, preserving the hex-suffixed name exactly as the crawler
always rendered it -- PR #878 scoped it this way: preserve each
branch's existing name argument exactly as the current code
produces it, since this is about not registering rather than
renaming anything. Same shape as
:meth:`test_unassigned_rows_do_not_mint` above, just for the one
probe that used to be the exception."""
always rendered it -- PR #878 scoped it this way: keeping the existing
hex-suffixed name, since this change is about not registering rather
than renaming. Same shape as :meth:`test_unassigned_rows_do_not_mint`
above, just for the one probe that used to be the exception."""
from pcapkit.const.reg.ethertype import EtherType

value, name = ETHERTYPE_FORMERLY_KEPT_PROBE
Expand All @@ -1568,10 +1566,10 @@ def test_formerly_attributed_vendor_block_no_longer_mints(self) -> None:

class IPXSocketMixedMintTests(unittest.TestCase):
""":class:`~pcapkit.const.ipx.socket.Socket` was the ruling's other mixed
case: ``Experimental`` and the three "who may claim this pool" allocation-
policy labels converted first, while ``Registered by Xerox`` -- a real
ownership fact -- kept minting. GitHub issue #775's final round converts
it too; see :meth:`test_registered_by_xerox_no_longer_mints` below."""
case: ``Experimental`` and the three dynamically/statically assigned
labels converted first, while ``Registered by Xerox``, the company one,
kept minting. GitHub issue #775's final round converts it too; see
:meth:`test_registered_by_xerox_no_longer_mints` below."""

def setUp(self) -> None:
snapshot = snapshot_modules(ISOLATED_PREFIXES)
Expand All @@ -1596,9 +1594,9 @@ def test_unassigned_rows_do_not_mint(self) -> None:
def test_registered_by_xerox_no_longer_mints(self) -> None:
"""The regression guard this class used to carry the other way: this
exact probe (``Registered by Xerox``, 0x0010) used to prove the
ruling *kept* minting a real ownership fact; GitHub issue #775's
final round converts it, preserving the hex-suffixed name exactly as
the crawler always rendered it -- same ruling, same reasoning as
ruling *kept* minting the company name; GitHub issue #775's final
round converts it, preserving the hex-suffixed name exactly as the
crawler always rendered it -- same ruling, same reasoning as
:meth:`EtherTypeMixedMintTests.
test_formerly_attributed_vendor_block_no_longer_mints`."""
from pcapkit.const.ipx.socket import Socket
Expand Down
4 changes: 2 additions & 2 deletions tests/const/test_const_ethertype_862_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def test_both_ranges_still_render_with_their_own_body(self) -> None:
# tests/const/test_const_enum_no_mint.py's own docstring -- so this
# now checks for the ``_unregistered_member`` form instead, keeping
# the hex-suffixed name exactly as before; only the registration
# mechanism changed, per the owner's ruling that this is "not about
# renaming anything".
# mechanism changed, because PR #878 scoped the change as not
# registering rather than renaming.
_enum, miss = self._process_fixture()
text = '\n'.join(miss)

Expand Down
Loading