Skip to content

Commit c150462

Browse files
committed
fix test_basic_indexing for dtype=datetime64[Y]
1 parent b98578b commit c150462

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/zarr/core/buffer/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def __setitem__(self, key: slice, value: Any) -> None:
142142
def __array__(
143143
self, dtype: npt.DTypeLike | None = None, copy: bool | None = True
144144
) -> npt.NDArray[Any]:
145-
return np.array(self._value, dtype=dtype, copy=copy)
145+
return np.array(self._value, dtype=dtype or self._dtype, copy=copy)
146146

147147
def reshape(
148148
self, shape: tuple[int, ...] | Literal[-1], *, order: Literal["A", "C", "F"] = "C"
@@ -557,7 +557,7 @@ def as_scalar(self) -> ScalarWrapper:
557557
"""
558558
if self._data.size != 1:
559559
raise ValueError("Buffer does not contain a single scalar value")
560-
return ScalarWrapper(self.as_numpy_array().item())
560+
return ScalarWrapper(self.as_numpy_array().item(), self.dtype)
561561

562562
@property
563563
def dtype(self) -> np.dtype[Any]:

0 commit comments

Comments
 (0)