1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
import os
import pytest
from conftest import odc_modules
data_file1 = os.path.join(os.path.dirname(__file__), "data/data1.odb")
@pytest.mark.parametrize("odyssey", odc_modules)
def test_count(odyssey):
r = odyssey.Reader(data_file1, aggregated=False)
frames = r.frames
assert len(frames) == 11
assert all(t.ncolumns == 55 for t in frames)
assert sum(t.nrows for t in frames) == 13
@pytest.mark.parametrize("odyssey", odc_modules)
def test_count_file(odyssey):
"""Check that we can open a file like object"""
with open(data_file1, "rb") as f:
r = odyssey.Reader(f, aggregated=False)
frames = r.frames
assert len(frames) == 11
assert all(t.ncolumns == 55 for t in frames)
assert sum(t.nrows for t in frames) == 13
@pytest.mark.parametrize("odyssey", odc_modules)
def test_count_aggregated_file(odyssey):
"""Check that we can open a file like object"""
with open(data_file1, "rb") as f:
r = odyssey.Reader(f, aggregated=True)
frames = r.frames
assert len(frames) == 1
assert all(t.ncolumns == 55 for t in frames)
assert sum(t.nrows for t in frames) == 13
if __name__ == "__main__":
pytest.main()
|