Skip to content

Commit 507161a

Browse files
committed
satisfy mypy for tests
1 parent 988f9df commit 507161a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/v3/test_codecs/test_vlen.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
from typing import Any
2+
13
import numpy as np
24
import pytest
35

46
from zarr import Array
57
from zarr.abc.store import Store
68
from zarr.codecs import VLenUTF8Codec
7-
from zarr.core.metadata.v3 import DataType
9+
from zarr.core.metadata.v3 import ArrayV3Metadata, DataType
810
from zarr.store.common import StorePath
911

1012

1113
@pytest.mark.parametrize("store", ["memory", "local"], indirect=["store"])
1214
@pytest.mark.parametrize("dtype", [None, np.dtypes.StrDType])
13-
async def test_vlen_string(store: Store, dtype) -> None:
15+
async def test_vlen_string(store: Store, dtype: None | np.dtype[Any]) -> None:
1416
strings = ["hello", "world", "this", "is", "a", "test"]
1517
data = np.array(strings).reshape((2, 3))
1618
if dtype is not None:
@@ -25,6 +27,7 @@ async def test_vlen_string(store: Store, dtype) -> None:
2527
fill_value="",
2628
codecs=[VLenUTF8Codec()],
2729
)
30+
assert isinstance(a.metadata, ArrayV3Metadata) # needed for mypy
2831

2932
a[:, :] = data
3033
assert np.array_equal(data, a[:, :])
@@ -33,6 +36,7 @@ async def test_vlen_string(store: Store, dtype) -> None:
3336

3437
# test round trip
3538
b = Array.open(sp)
39+
assert isinstance(b.metadata, ArrayV3Metadata) # needed for mypy
3640
assert np.array_equal(data, b[:, :])
3741
assert b.metadata.data_type == DataType.string
3842
assert b.dtype == np.dtypes.StringDType()

0 commit comments

Comments
 (0)