Skip to content

Commit 34bf260

Browse files
committed
fix mypy in tests
1 parent 3348439 commit 34bf260

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

tests/test_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_open_with_mode_r(tmp_path: pathlib.Path) -> None:
235235
z2 = zarr.open(store=tmp_path, mode="r")
236236
assert isinstance(z2, Array)
237237
assert z2.fill_value == 1
238-
assert (z2[:] == 1).all()
238+
assert np.array(z2[:] == 1).all()
239239
with pytest.raises(ValueError):
240240
z2[:] = 3
241241

@@ -247,7 +247,7 @@ def test_open_with_mode_r_plus(tmp_path: pathlib.Path) -> None:
247247
zarr.ones(store=tmp_path, shape=(3, 3))
248248
z2 = zarr.open(store=tmp_path, mode="r+")
249249
assert isinstance(z2, Array)
250-
assert (z2[:] == 1).all()
250+
assert np.array(z2[:] == 1).all()
251251
z2[:] = 3
252252

253253

@@ -263,7 +263,7 @@ async def test_open_with_mode_a(tmp_path: pathlib.Path) -> None:
263263
arr[...] = 1
264264
z2 = zarr.open(store=tmp_path, mode="a")
265265
assert isinstance(z2, Array)
266-
assert (z2[:] == 1).all()
266+
assert np.array(z2[:] == 1).all()
267267
z2[:] = 3
268268

269269

@@ -1119,5 +1119,5 @@ def test_open_array_with_mode_r_plus(store: Store) -> None:
11191119
zarr.ones(store=store, shape=(3, 3))
11201120
z2 = zarr.open_array(store=store, mode="r+")
11211121
assert isinstance(z2, Array)
1122-
assert (z2[:] == 1).all()
1122+
assert np.array(z2[:] == 1).all()
11231123
z2[:] = 3

tests/test_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,15 +648,15 @@ def test_resize_1d(store: MemoryStore, zarr_format: ZarrFormat) -> None:
648648
a = np.arange(105, dtype="i4")
649649
z[:] = a
650650
assert (105,) == z.shape
651-
assert (105,) == z[:].shape
651+
assert (105,) == z[:].shape # type: ignore
652652
assert np.dtype("i4") == z.dtype
653-
assert np.dtype("i4") == z[:].dtype
653+
assert np.dtype("i4") == z[:].dtype # type: ignore
654654
assert (10,) == z.chunks
655655
np.testing.assert_array_equal(a, z[:])
656656

657657
z.resize(205)
658658
assert (205,) == z.shape
659-
assert (205,) == z[:].shape
659+
assert (205,) == z[:].shape # type: ignore
660660
assert np.dtype("i4") == z.dtype
661661
assert np.dtype("i4") == z[:].dtype
662662
assert (10,) == z.chunks

tests/test_buffer.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ async def test_async_array_prototype() -> None:
6262
prototype=my_prototype,
6363
)
6464
got = await a.getitem(selection=(slice(0, 9), slice(0, 9)), prototype=my_prototype)
65-
# ignoring a mypy error here that TestNDArrayLike doesn't meet the NDArrayLike protocol
66-
# The test passes, so it clearly does.
67-
assert isinstance(got, TestNDArrayLike) # type: ignore[unreachable]
68-
assert np.array_equal(expect, got) # type: ignore[unreachable]
65+
assert isinstance(got, TestNDArrayLike)
66+
assert np.array_equal(expect, got)
6967

7068

7169
@gpu_test
@@ -115,10 +113,8 @@ async def test_codecs_use_of_prototype() -> None:
115113
prototype=my_prototype,
116114
)
117115
got = await a.getitem(selection=(slice(0, 10), slice(0, 10)), prototype=my_prototype)
118-
# ignoring a mypy error here that TestNDArrayLike doesn't meet the NDArrayLike protocol
119-
# The test passes, so it clearly does.
120-
assert isinstance(got, TestNDArrayLike) # type: ignore[unreachable]
121-
assert np.array_equal(expect, got) # type: ignore[unreachable]
116+
assert isinstance(got, TestNDArrayLike)
117+
assert np.array_equal(expect, got)
122118

123119

124120
@gpu_test

0 commit comments

Comments
 (0)