Skip to content

Commit 66c0798

Browse files
committed
fix mypy in tests
1 parent 75d6cdf commit 66c0798

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/zarr/api/synchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def load(
118118
path: str | None = None,
119119
zarr_format: ZarrFormat | None = None,
120120
zarr_version: ZarrFormat | None = None,
121-
) -> NDArrayLike | dict[str, NDArrayLike]:
121+
) -> npt.ArrayLike | dict[str, npt.ArrayLike]:
122122
"""Load data from an array or group into memory.
123123
124124
Parameters

src/zarr/core/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ async def _get_selection(
12461246
drop_axes=indexer.drop_axes,
12471247
)
12481248
if indexer.shape == ():
1249-
return cast(out_buffer.as_numpy_array().item(), out_buffer.dtype)
1249+
return cast(out_buffer.as_numpy_array().item(), npt.ArrayLike)
12501250
return out_buffer.as_ndarray_like()
12511251

12521252
async def getitem(

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_open_with_mode_w(tmp_path: pathlib.Path) -> None:
275275
arr[...] = 3
276276
z2 = zarr.open(store=tmp_path, mode="w", shape=(3, 3))
277277
assert isinstance(z2, Array)
278-
assert not (z2[:] == 3).all()
278+
assert not np.array(z2[:] == 3).all()
279279
z2[:] = 3
280280

281281

tests/test_array.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ def test_resize_1d(store: MemoryStore, zarr_format: ZarrFormat) -> None:
658658
assert (205,) == z.shape
659659
assert (205,) == z[:].shape # type: ignore[union-attr]
660660
assert np.dtype("i4") == z.dtype
661-
assert np.dtype("i4") == z[:].dtype
661+
assert np.dtype("i4") == z[:].dtype # type: ignore[union-attr]
662662
assert (10,) == z.chunks
663663
np.testing.assert_array_equal(a, z[:105])
664664
np.testing.assert_array_equal(np.zeros(100, dtype="i4"), z[105:])
@@ -693,15 +693,15 @@ def test_resize_2d(store: MemoryStore, zarr_format: ZarrFormat) -> None:
693693
assert (105, 105) == z.shape
694694
assert (105, 105) == z[:].shape # type: ignore[union-attr]
695695
assert np.dtype("i4") == z.dtype
696-
assert np.dtype("i4") == z[:].dtype
696+
assert np.dtype("i4") == z[:].dtype # type: ignore[union-attr]
697697
assert (10, 10) == z.chunks
698698
np.testing.assert_array_equal(a, z[:])
699699

700700
z.resize((205, 205))
701701
assert (205, 205) == z.shape
702702
assert (205, 205) == z[:].shape # type: ignore[union-attr]
703703
assert np.dtype("i4") == z.dtype
704-
assert np.dtype("i4") == z[:].dtype
704+
assert np.dtype("i4") == z[:].dtype # type: ignore[union-attr]
705705
assert (10, 10) == z.chunks
706706
np.testing.assert_array_equal(a, z[:105, :105])
707707
np.testing.assert_array_equal(np.zeros((100, 205), dtype="i4"), z[105:, :])
@@ -711,23 +711,23 @@ def test_resize_2d(store: MemoryStore, zarr_format: ZarrFormat) -> None:
711711
assert (55, 55) == z.shape
712712
assert (55, 55) == z[:].shape # type: ignore[union-attr]
713713
assert np.dtype("i4") == z.dtype
714-
assert np.dtype("i4") == z[:].dtype
714+
assert np.dtype("i4") == z[:].dtype # type: ignore[union-attr]
715715
assert (10, 10) == z.chunks
716716
np.testing.assert_array_equal(a[:55, :55], z[:])
717717

718718
z.resize((55, 1))
719719
assert (55, 1) == z.shape
720720
assert (55, 1) == z[:].shape # type: ignore[union-attr]
721721
assert np.dtype("i4") == z.dtype
722-
assert np.dtype("i4") == z[:].dtype
722+
assert np.dtype("i4") == z[:].dtype # type: ignore[union-attr]
723723
assert (10, 10) == z.chunks
724724
np.testing.assert_array_equal(a[:55, :1], z[:])
725725

726726
z.resize((1, 55))
727727
assert (1, 55) == z.shape
728728
assert (1, 55) == z[:].shape # type: ignore[union-attr]
729729
assert np.dtype("i4") == z.dtype
730-
assert np.dtype("i4") == z[:].dtype
730+
assert np.dtype("i4") == z[:].dtype # type: ignore[union-attr]
731731
assert (10, 10) == z.chunks
732732
np.testing.assert_array_equal(a[:1, :10], z[:, :10])
733733
np.testing.assert_array_equal(np.zeros((1, 55 - 10), dtype="i4"), z[:, 10:55])

0 commit comments

Comments
 (0)