Skip to content

Commit 300d03a

Browse files
committed
fix mypy in test_api.py and test_array.py
1 parent 0886e77 commit 300d03a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/test_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def test_open_with_mode_r(tmp_path: pathlib.Path) -> None:
237237
assert isinstance(z2, Array)
238238
assert z2.fill_value == 1
239239
assert isinstance(z2[:], NDArrayLike)
240-
assert (z2[:] == 1).all() # type: ignore [operator]
240+
assert (z2[:] == 1).all() # type: ignore [union-attr]
241241
with pytest.raises(ValueError):
242242
z2[:] = 3
243243

@@ -250,7 +250,7 @@ def test_open_with_mode_r_plus(tmp_path: pathlib.Path) -> None:
250250
z2 = zarr.open(store=tmp_path, mode="r+")
251251
assert isinstance(z2, Array)
252252
assert isinstance(z2[:], NDArrayLike)
253-
assert (z2[:] == 1).all() # type: ignore [operator]
253+
assert (z2[:] == 1).all() # type: ignore [union-attr]
254254
z2[:] = 3
255255

256256

@@ -267,7 +267,7 @@ async def test_open_with_mode_a(tmp_path: pathlib.Path) -> None:
267267
z2 = zarr.open(store=tmp_path, mode="a")
268268
assert isinstance(z2, Array)
269269
assert isinstance(z2[:], NDArrayLike)
270-
assert (z2[:] == 1).all() # type: ignore [operator]
270+
assert (z2[:] == 1).all() # type: ignore [union-attr]
271271
z2[:] = 3
272272

273273

@@ -280,7 +280,7 @@ def test_open_with_mode_w(tmp_path: pathlib.Path) -> None:
280280
z2 = zarr.open(store=tmp_path, mode="w", shape=(3, 3))
281281
assert isinstance(z2, Array)
282282
assert isinstance(z2[:], NDArrayLike)
283-
assert (z2[:] == 3).all() # type: ignore [operator]
283+
assert (z2[:] == 3).all() # type: ignore [union-attr]
284284
z2[:] = 3
285285

286286

tests/test_array.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
create_array,
3939
)
4040
from zarr.core.buffer import default_buffer_prototype
41+
from zarr.core.buffer.core import NDArrayLike
4142
from zarr.core.buffer.cpu import NDBuffer
4243
from zarr.core.chunk_grids import _auto_partition
4344
from zarr.core.common import JSON, MemoryOrder, ZarrFormat
@@ -655,6 +656,7 @@ def test_resize_1d(store: MemoryStore, zarr_format: ZarrFormat) -> None:
655656
a = np.arange(105, dtype="i4")
656657
z[:] = a
657658
assert (105,) == z.shape
659+
assert isinstance(z[:], NDArrayLike)
658660
assert (105,) == z[:].shape
659661
assert np.dtype("i4") == z.dtype
660662
assert np.dtype("i4") == z[:].dtype

0 commit comments

Comments
 (0)