From 5268884050e0e3d65d2ea42e44f6fe819ebeef48 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Fri, 11 Oct 2024 00:19:59 -0700 Subject: [PATCH] use the validated array instance in testing numpy dump to array, not the array we would generate --- src/numpydantic/interface/dask.py | 2 +- tests/test_interface/test_interfaces.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/numpydantic/interface/dask.py b/src/numpydantic/interface/dask.py index 257e56a..62867a0 100644 --- a/src/numpydantic/interface/dask.py +++ b/src/numpydantic/interface/dask.py @@ -83,7 +83,7 @@ def _chunked_to_model(array: np.ndarray) -> np.ndarray: def _vectorized_to_model(item: Union[dict, BaseModel]) -> BaseModel: if not isinstance(item, self.dtype): return self.dtype(**item) - else: + else: # pragma: no cover return item return np.vectorize(_vectorized_to_model)(array) diff --git a/tests/test_interface/test_interfaces.py b/tests/test_interface/test_interfaces.py index 028502c..dcce5cd 100644 --- a/tests/test_interface/test_interfaces.py +++ b/tests/test_interface/test_interfaces.py @@ -74,12 +74,13 @@ def test_interface_rematch(interface_cases, tmp_output_dir_func): ) -def test_interface_to_numpy_array(dtype_by_interface): +def test_interface_to_numpy_array(dtype_by_interface_instance): """ All interfaces should be able to have the output of their validation stage coerced to a numpy array with np.array() """ - _ = np.array(dtype_by_interface.array) + + _ = np.array(dtype_by_interface_instance.array) @pytest.mark.serialization