Skip to content

Commit 4cb86d3

Browse files
committed
update tests
1 parent 3575c56 commit 4cb86d3

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

python/lib/sift_client/_tests/util/test_hdf5.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
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."""
82

93
import h5py
104
import numpy as np
115
import pytest
126

137
from sift_client._internal.util.hdf5 import detect_hdf5_config
148
from sift_client.sift_types.channel import ChannelDataType
15-
from sift_client.sift_types.data_import import TimeFormat
169

1710

1811
@pytest.fixture
@@ -128,13 +121,12 @@ def populate(hdf5_file):
128121
assert config.data[0].units == "V"
129122
assert config.data[0].description == "Supply voltage"
130123

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."""
133126

134127
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))
138130

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

Comments
 (0)