refactor: remove all backward-compat shims from sim/
Deletes 24 shim files from sim/. All test imports now point directly to canonical transponders/ and trace/ paths. sim/ contains only infrastructure (15 files): frame, memory, transponder ABC, reader ABC, medium, sim_session, table_compiler, replay, relay, fuzzer, pm3medium, mcu_bridge, mcu_protocol, dual_session, __init__. 751 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import struct
|
||||
import pytest
|
||||
|
||||
from pm3py.sim.frame import RFFrame
|
||||
from pm3py.sim.nxp_icode import (
|
||||
from pm3py.transponders.hf.iso15693.nxp.nxp_icode import (
|
||||
CMD_SET_EAS, CMD_RESET_EAS, CMD_LOCK_EAS, CMD_EAS_ALARM,
|
||||
CMD_PASSWORD_PROTECT_EAS_AFI, CMD_WRITE_EAS_ID,
|
||||
CMD_INVENTORY_READ, CMD_FAST_INVENTORY_READ,
|
||||
@@ -45,23 +45,23 @@ PWD_EAS_AFI = 0x10
|
||||
class TestIcodeSlixBasics:
|
||||
def test_import(self):
|
||||
"""IcodeSlixTag can be imported."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
|
||||
def test_inherits_nxp_icode(self):
|
||||
"""SLIX inherits from NxpIcodeTag."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.sim.nxp_icode import NxpIcodeTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.nxp_icode import NxpIcodeTag
|
||||
assert issubclass(IcodeSlixTag, NxpIcodeTag)
|
||||
|
||||
def test_default_28_blocks(self):
|
||||
"""SLIX defaults to 28 blocks × 4 bytes."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
assert tag._num_blocks == 28
|
||||
assert tag._block_size == 4
|
||||
|
||||
def test_responds_to_inventory(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
inv = bytes([0x26, 0x01, 0x00])
|
||||
@@ -69,7 +69,7 @@ class TestIcodeSlixBasics:
|
||||
assert resp is not None
|
||||
|
||||
def test_read_write_block(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
# Write block 5
|
||||
@@ -89,7 +89,7 @@ class TestIcodeSlixBasics:
|
||||
class TestIcodeSlixPassword:
|
||||
def test_set_password_eas_afi(self):
|
||||
"""SET_PASSWORD with correct EAS/AFI password succeeds."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -97,7 +97,7 @@ class TestIcodeSlixPassword:
|
||||
|
||||
def test_set_password_wrong(self):
|
||||
"""SET_PASSWORD with wrong password fails."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -108,7 +108,7 @@ class TestIcodeSlixPassword:
|
||||
|
||||
def test_write_password(self):
|
||||
"""WRITE_PASSWORD changes the EAS/AFI password."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -122,7 +122,7 @@ class TestIcodeSlixPassword:
|
||||
|
||||
def test_lock_password(self):
|
||||
"""LOCK_PASSWORD prevents WRITE_PASSWORD."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -139,7 +139,7 @@ class TestIcodeSlixPassword:
|
||||
|
||||
def test_no_privacy_password(self):
|
||||
"""SLIX has no privacy — only EAS/AFI password accepted."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -156,7 +156,7 @@ class TestIcodeSlixPassword:
|
||||
|
||||
class TestIcodeSlixEas:
|
||||
def test_set_eas(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, CMD_SET_EAS, 0x04])
|
||||
@@ -165,7 +165,7 @@ class TestIcodeSlixEas:
|
||||
assert tag.eas_enabled
|
||||
|
||||
def test_reset_eas(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
tag.set_eas(True)
|
||||
@@ -175,7 +175,7 @@ class TestIcodeSlixEas:
|
||||
assert not tag.eas_enabled
|
||||
|
||||
def test_eas_alarm(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
tag.set_eas(True)
|
||||
@@ -186,7 +186,7 @@ class TestIcodeSlixEas:
|
||||
assert len(resp.data) >= 33
|
||||
|
||||
def test_eas_alarm_silent_when_disabled(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, CMD_EAS_ALARM, 0x04])
|
||||
@@ -194,7 +194,7 @@ class TestIcodeSlixEas:
|
||||
assert resp is None
|
||||
|
||||
def test_lock_eas(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
tag.set_eas(True)
|
||||
@@ -207,7 +207,7 @@ class TestIcodeSlixEas:
|
||||
assert resp.data[0] & 0x01
|
||||
|
||||
def test_password_protect_eas_afi(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -219,7 +219,7 @@ class TestIcodeSlixEas:
|
||||
|
||||
def test_write_eas_id(self):
|
||||
"""WRITE EAS ID is SLIX2-only (EAS Selective per AN11809)."""
|
||||
from pm3py.sim.icode_slix2 import IcodeSlix2Tag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix2 import IcodeSlix2Tag
|
||||
tag = IcodeSlix2Tag(uid=b"\xE0\x04\x02" + bytes(5),
|
||||
eas_afi_password=0xAABBCCDD)
|
||||
run(tag.power_on())
|
||||
@@ -231,7 +231,7 @@ class TestIcodeSlixEas:
|
||||
|
||||
def test_slix_rejects_write_eas_id(self):
|
||||
"""SLIX (SL2S2002) does not support WRITE EAS ID (0xA7)."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, CMD_WRITE_EAS_ID, 0x04, 0x34, 0x12])
|
||||
@@ -245,7 +245,7 @@ class TestIcodeSlixEas:
|
||||
|
||||
class TestIcodeSlixInventoryRead:
|
||||
def test_inventory_read(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10\x03\x04\x05\x06")
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x06, CMD_INVENTORY_READ, 0x04, 0x00, 0x00, 0x00])
|
||||
@@ -254,7 +254,7 @@ class TestIcodeSlixInventoryRead:
|
||||
assert resp.data[0] == 0x00
|
||||
|
||||
def test_fast_inventory_read(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10\x03\x04\x05\x06")
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x06, CMD_FAST_INVENTORY_READ, 0x04, 0x00, 0x00, 0x00])
|
||||
@@ -271,12 +271,12 @@ class TestSlix2StillWorks:
|
||||
"""Verify SLIX2 inherits from SLIX and retains all features."""
|
||||
|
||||
def test_slix2_inherits_slix(self):
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.sim.icode_slix2 import IcodeSlix2Tag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix2 import IcodeSlix2Tag
|
||||
assert issubclass(IcodeSlix2Tag, IcodeSlixTag)
|
||||
|
||||
def test_slix2_privacy_still_works(self):
|
||||
from pm3py.sim.icode_slix2 import IcodeSlix2Tag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix2 import IcodeSlix2Tag
|
||||
tag = IcodeSlix2Tag(uid=b"\xE0\x04\x02" + bytes(5),
|
||||
privacy_password=0xDEADBEEF)
|
||||
run(tag.power_on())
|
||||
@@ -284,7 +284,7 @@ class TestSlix2StillWorks:
|
||||
assert tag.privacy_mode
|
||||
|
||||
def test_slix2_destroy_still_works(self):
|
||||
from pm3py.sim.icode_slix2 import IcodeSlix2Tag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix2 import IcodeSlix2Tag
|
||||
tag = IcodeSlix2Tag(uid=b"\xE0\x04\x02" + bytes(5),
|
||||
destroy_password=0xDEAD1234)
|
||||
run(tag.power_on())
|
||||
@@ -298,7 +298,7 @@ class TestSlix2StillWorks:
|
||||
|
||||
def test_slix2_eas_inherited_from_slix(self):
|
||||
"""SLIX2 EAS works via inheritance from SLIX."""
|
||||
from pm3py.sim.icode_slix2 import IcodeSlix2Tag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix2 import IcodeSlix2Tag
|
||||
tag = IcodeSlix2Tag(uid=b"\xE0\x04\x02" + bytes(5))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, CMD_SET_EAS, 0x04])
|
||||
@@ -314,7 +314,7 @@ class TestSlix2StillWorks:
|
||||
class TestSlixLacksPrivacy:
|
||||
def test_no_enable_privacy(self):
|
||||
"""SLIX does not respond to ENABLE PRIVACY (0xBA)."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, 0xBA, 0x04, 0x00, 0x00, 0x00, 0x00])
|
||||
@@ -324,7 +324,7 @@ class TestSlixLacksPrivacy:
|
||||
|
||||
def test_no_destroy(self):
|
||||
"""SLIX does not respond to DESTROY (0xB9)."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, 0xB9, 0x04, 0x00, 0x00, 0x00, 0x00])
|
||||
@@ -333,7 +333,7 @@ class TestSlixLacksPrivacy:
|
||||
|
||||
def test_no_protect_page(self):
|
||||
"""SLIX does not respond to PROTECT PAGE (0xB6)."""
|
||||
from pm3py.sim.icode_slix import IcodeSlixTag
|
||||
from pm3py.transponders.hf.iso15693.nxp.icode_slix import IcodeSlixTag
|
||||
tag = IcodeSlixTag(uid=b"\xE0\x04\x01\x10" + bytes(4))
|
||||
run(tag.power_on())
|
||||
cmd = bytes([0x02, 0xB6, 0x04, 0x08, 0x01])
|
||||
|
||||
Reference in New Issue
Block a user