test: the Series-3 fake downloads a real event -- c32a9e7 was pushed with 4 tests failing
c32a9e7 made the download check read the 5A body; the Series-3 fake handed
back placeholder frames (['frame']), so 4 plumbing tests in
test_device_access_s3_events.py and test_device_access_event_dispatch.py
failed with "'str' object has no attribute 'data'" -- and that commit was
pushed without the failure set being read. The fake's one-event download now
carries what a real one does: BE9441 event 1's recorded frames, their decoded
waveform and the unit's own peaks for it. Those tests now see verified=True
on a whole event. Suite back to the 16 known fixture failures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
c32a9e7851
commit
a7214c50de
3 files changed
+27
-3
No files matched your search
@@ -148,11 +148,34 @@ class FakeMiniMateClient(_Base):
|
||||
if expected_timestamp is not None and _iso(ev) != expected_timestamp:
|
||||
ev = copy.copy(ev)
|
||||
ev._a5_frames = None
|
||||
elif ev._a5_frames:
|
||||
_as_downloaded(ev)
|
||||
self.last_download = ev
|
||||
return ev
|
||||
return None
|
||||
|
||||
|
||||
_REAL = {}
|
||||
|
||||
|
||||
def _as_downloaded(ev):
|
||||
"""Give a fake event what a real one-event download carries: BE9441 event 1's
|
||||
recorded A5 frames, their decoded waveform, and the unit's own 0C peaks for it
|
||||
-- so the download check sees a whole, matching event."""
|
||||
if not _REAL:
|
||||
from minimateplus.framing import S3FrameParser
|
||||
from minimateplus.waveform_codec import decode_a5_frames
|
||||
raw = (Path(__file__).parent / "fixtures" / "minimate-bench-10-25-26"
|
||||
/ "BE9441_event1_0111646a_rx.bin").read_bytes()
|
||||
_REAL["frames"] = [f for f in S3FrameParser().feed(raw) if f.sub == 0xA5]
|
||||
_REAL["samples"] = decode_a5_frames(_REAL["frames"])
|
||||
ev._a5_frames = _REAL["frames"]
|
||||
ev.raw_samples = _REAL["samples"]
|
||||
pv = ev.peak_values
|
||||
ev.peak_values = PeakValues(tran=0.030, vert=0.095, long=0.020, micl=pv.micl if pv else None,
|
||||
peak_vector_sum=pv.peak_vector_sum if pv else None)
|
||||
|
||||
|
||||
def s4_ref(index, key_hex, when, record_type, *, pvs=0.2):
|
||||
"""Fixture-backed: the filename it produces names a real file in thor-idf/."""
|
||||
ref = MicromateEventRef(index=index, key=bytes.fromhex(key_hex), size=0, serial="UM20147",
|
||||
|
||||
@@ -61,7 +61,7 @@ def test_an_id_from_another_unit_is_refused_before_any_io():
|
||||
|
||||
def test_a_minimate_download_goes_through_the_series3_adapter():
|
||||
dl = access(s3=[FakeMiniMateClient()]).download_event(ADDR, "BE18193", "BE18193:01110000:-")
|
||||
assert dl.series == 3 and dl.a5_frames == ["frame"]
|
||||
assert dl.series == 3 and dl.a5_frames and all(f.sub == 0xA5 for f in dl.a5_frames)
|
||||
|
||||
|
||||
def test_a_ring_mid_download_releases_the_line_and_downloads_nothing():
|
||||
|
||||
@@ -70,8 +70,9 @@ def test_listing_refuses_a_different_unit():
|
||||
def test_download_returns_the_event_its_frames_and_the_settings():
|
||||
fake = FakeMiniMateClient()
|
||||
dl = adapter(fake).download_event(TCP, "BE18193", FIRST, "20261001080000")
|
||||
assert (dl.series, dl.event_id, dl.verified) == (3, "BE18193:01110000:20261001080000", None)
|
||||
assert dl.event is fake.events[0] and dl.a5_frames == ["frame"]
|
||||
assert (dl.series, dl.event_id, dl.verified) == (3, "BE18193:01110000:20261001080000", True)
|
||||
assert dl.event is fake.events[0] and dl.a5_frames is fake.events[0]._a5_frames
|
||||
assert dl.a5_frames and all(f.sub == 0xA5 for f in dl.a5_frames)
|
||||
assert dl.compliance is fake.compliance and dl.filename.startswith("T193")
|
||||
assert dl.timestamp == datetime.datetime(2026, 10, 1, 8, 0, 0)
|
||||
|
||||
|
||||
Reference in new issue
Block a user