Skip to content

Commit

Permalink
use the validated array instance in testing numpy dump to array, not …
Browse files Browse the repository at this point in the history
…the array we would generate
  • Loading branch information
sneakers-the-rat committed Oct 11, 2024
1 parent 09a5f51 commit 5268884
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/numpydantic/interface/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_interface/test_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5268884

Please sign in to comment.