|
1 | | -"""Tests for detect_hdf5_config. |
2 | | -
|
3 | | -These tests verify that the client-side detect_hdf5_config matches the |
4 | | -backend hdf5.py detect_config 1-to-1. Any client-specific heuristics |
5 | | -(e.g. sibling "timestamps" resolution, 2D dataset handling, "values" |
6 | | -leaf naming) are intentionally NOT present and should not be added. |
7 | | -""" |
| 1 | +"""Tests for detect_hdf5_config.""" |
8 | 2 |
|
9 | 3 | import h5py |
10 | 4 | import numpy as np |
11 | 5 | import pytest |
12 | 6 |
|
13 | 7 | from sift_client._internal.util.hdf5 import detect_hdf5_config |
14 | 8 | from sift_client.sift_types.channel import ChannelDataType |
15 | | -from sift_client.sift_types.data_import import TimeFormat |
16 | 9 |
|
17 | 10 |
|
18 | 11 | @pytest.fixture |
@@ -128,13 +121,12 @@ def populate(hdf5_file): |
128 | 121 | assert config.data[0].units == "V" |
129 | 122 | assert config.data[0].description == "Supply voltage" |
130 | 123 |
|
131 | | - def test_returns_correct_wrapper_type(self, create_hdf5_file): |
132 | | - """Config wrapper uses correct time format and empty asset_name.""" |
| 124 | + def test_unsupported_dtype_raises(self, create_hdf5_file): |
| 125 | + """Unsupported numpy dtypes raise ValueError rather than silently dropping data.""" |
133 | 126 |
|
134 | 127 | def populate(hdf5_file): |
135 | | - hdf5_file.create_dataset("x", data=np.array([1.0, 2.0])) |
136 | | - |
137 | | - config = detect_hdf5_config(create_hdf5_file(populate)) |
| 128 | + hdf5_file.create_dataset("time", data=np.arange(5, dtype="<i8")) |
| 129 | + hdf5_file.create_dataset("data", data=np.zeros(5, dtype=np.float16)) |
138 | 130 |
|
139 | | - assert config.asset_name == "" |
140 | | - assert config.time_format == TimeFormat.ABSOLUTE_UNIX_NANOSECONDS |
| 131 | + with pytest.raises(ValueError, match="Unsupported numpy dtype"): |
| 132 | + detect_hdf5_config(create_hdf5_file(populate)) |
0 commit comments