Skip to content

Commit

Permalink
separate tests for seeking and non-seeking readers
Browse files Browse the repository at this point in the history
  • Loading branch information
jtbandes authored Jul 21, 2023
1 parent 6a7df28 commit 90a6182
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions python/mcap/tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,22 @@ def write_no_summary_mcap(filepath: Path):
writer.finish()


@pytest.mark.parametrize("reader_cls", READER_SUBCLASSES)
def test_no_summary(reader_cls: AnyReaderSubclass, tmpdir: Path):
def test_no_summary_seeking(tmpdir: Path):
filepath = tmpdir / "no_summary.mcap"
write_no_summary_mcap(filepath)

with open(filepath, "rb") as f:
reader: McapReader = reader_cls(f)
reader = SeekingReader(f)
assert len(list(reader.iter_messages())) == 200
assert len(list(reader.iter_attachments())) == 1
assert len(list(reader.iter_metadata())) == 1


def test_no_summary_not_seeking(tmpdir: Path):
filepath = tmpdir / "no_summary.mcap"
write_no_summary_mcap(filepath)

with open(filepath, "rb") as f:
assert len(list(NonSeekingReader(f).iter_messages())) == 200
assert len(list(NonSeekingReader(f).iter_attachments())) == 1
assert len(list(NonSeekingReader(f).iter_metadata())) == 1

0 comments on commit 90a6182

Please sign in to comment.