Skip to content

Pin public I/O behavior before record refactor - #750

Merged
tompollard merged 2 commits into
mainfrom
test/io-compatibility-baseline-749
Nov 27, 2026
Merged

tompollard merged 2 commits into
mainfrom
test/io-compatibility-baseline-749

Conversation

@tompollard

Copy link
Copy Markdown
Member

Summary

Add focused, offline characterization tests for the current public I/O behavior before changing the record model. This is the first compatibility baseline for #749; it changes no production API or behavior.

The tests cover:

  • Header-only versus loaded Record values, selected metadata, and expanded per-channel frame counts.
  • The current Record/MultiRecord return choices and positional rdrecord arguments.
  • The (signals, fields) shape and field keys returned by rdsamp.
  • In-place edits to sig_name followed by writing and reading a copy.
  • Pickling of Record, MultiRecord, and Annotation. MultiRecord is checked by its restored fields and segments because it does not currently implement value equality.

Existing tests already cover many numerical values, formats, and multi-segment ranges; this PR pins the compatibility seams most likely to be affected by #743–#748.

Checks

  • tests/test_io_compatibility.py: 8 passed.
  • Ruff check and format pass.
  • git diff --check passes.

@tompollard tompollard left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two assertions need strengthening for this to serve as a compatibility baseline:

  1. MultiRecord pickle coverage (tests/test_io_compatibility.py:121-134): sampto=8 loads only the first of the three 75,000-frame segments. The assertions also omit top-level fields such as fs, n_sig, and sig_len, so losing those fields during serialization would pass. A two-frame window across the first boundary (sampfrom=74999, sampto=75001) exercises two loaded segments without a large read; please compare the top-level fields after unpickling too.

  2. rdsamp metadata values (tests/test_io_compatibility.py:65-77): The test checks the field names but does not pin the values of fs, units, or comments. Those could regress while this test still passes. Please assert the known values from sample-data/100, giving the test an independent expected result.

These are gaps in the new tests, not observed production failures.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks for the careful review. Addressed both gaps in 04a24e5.

  1. The MultiRecord pickle test now reads frames 74,999 and 75,000, loading one frame from each of two segments. It checks the restored top-level fs, n_sig, sig_len, layout, segment count/names/lengths, and both loaded segment objects.
  2. The rdsamp test now asserts the complete expected metadata dictionary from sample-data/100, including fs=360, units=['mV'], and all three comments, rather than checking only the keys.

Verification: all 8 compatibility tests pass; Ruff check and format pass.

@tompollard
tompollard merged commit 1cc9ff8 into main Nov 27, 2026
19 checks passed
@tompollard
tompollard deleted the test/io-compatibility-baseline-749 branch November 27, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant