Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test round-trip write/read of supported binary formats #509

Merged
merged 1 commit into from
Oct 21, 2024
Merged
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
21 changes: 21 additions & 0 deletions tests/test_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ def test_1f(self):
"Mismatch in %s" % name,
)

# Test writing all supported formats. (Currently not all signal
# formats are supported for output; keep this list in sync with
# 'wr_dat_file' in wfdb/io/_signal.py.)
OUTPUT_FMTS = ["80", "212", "16", "24", "32"]
channels = []
for i, fmt in enumerate(record.fmt):
if fmt in OUTPUT_FMTS:
channels.append(i)

partial_record = wfdb.rdrecord(
"sample-data/binformats",
physical=False,
channels=channels,
)
partial_record.wrsamp(write_dir=self.temp_path)
converted_record = wfdb.rdrecord(
os.path.join(self.temp_path, "binformats"),
physical=False,
)
assert partial_record == converted_record

def test_read_write_flac(self):
"""
All FLAC formats, multiple signal files in one record.
Expand Down
Loading