Skip to content

Commit fd10c29

Browse files
committed
Test coverage fix
1 parent 717a8ee commit fd10c29

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

nptdms/test/test_tdms_file.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,20 @@ def test_read_with_index_file(test_file, expected_data):
482482
compare_arrays(channel_obj.data, expected_channel_data)
483483

484484

485+
def test_read_index_file_only():
486+
""" Test reading the index file directly
487+
"""
488+
test_file, expected_data = scenarios.single_segment_with_two_channels().values
489+
with test_file.get_tempfile_with_index() as tdms_file_path:
490+
with TdmsFile.open(tdms_file_path + "_index") as tdms_file:
491+
for ((group, channel), expected_channel_data) in expected_data.items():
492+
channel_obj = tdms_file[group][channel]
493+
assert len(channel_obj) == len(expected_channel_data)
494+
with pytest.raises(RuntimeError) as exc_info:
495+
channel_obj[:]
496+
assert "Data cannot be read from index file only" in str(exc_info.value)
497+
498+
485499
@pytest.mark.skipif(sys.version_info < (3, 4), reason="pathlib only available in stdlib since 3.4")
486500
def test_read_file_passed_as_pathlib_path():
487501
""" Test reading a file when using a pathlib Path object

0 commit comments

Comments
 (0)