Skip to content

Commit

Permalink
Test coverage fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreeve committed Feb 18, 2024
1 parent 717a8ee commit fd10c29
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nptdms/test/test_tdms_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,20 @@ def test_read_with_index_file(test_file, expected_data):
compare_arrays(channel_obj.data, expected_channel_data)


def test_read_index_file_only():
""" Test reading the index file directly
"""
test_file, expected_data = scenarios.single_segment_with_two_channels().values
with test_file.get_tempfile_with_index() as tdms_file_path:
with TdmsFile.open(tdms_file_path + "_index") as tdms_file:
for ((group, channel), expected_channel_data) in expected_data.items():
channel_obj = tdms_file[group][channel]
assert len(channel_obj) == len(expected_channel_data)
with pytest.raises(RuntimeError) as exc_info:
channel_obj[:]
assert "Data cannot be read from index file only" in str(exc_info.value)


@pytest.mark.skipif(sys.version_info < (3, 4), reason="pathlib only available in stdlib since 3.4")
def test_read_file_passed_as_pathlib_path():
""" Test reading a file when using a pathlib Path object
Expand Down

0 comments on commit fd10c29

Please sign in to comment.