Skip to content

Commit 1925b8e

Browse files
committed
Fix typing in test_core
1 parent 26811eb commit 1925b8e

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ module = [
364364
"tests.test_store.test_local",
365365
"tests.test_store.test_fsspec",
366366
"tests.test_store.test_memory",
367+
"tests.test_store.test_core",
367368
]
368369
strict = false
369370

@@ -373,7 +374,6 @@ strict = false
373374
module = [
374375
"tests.test_codecs.test_codecs",
375376
"tests.test_metadata.*",
376-
"tests.test_store.test_core",
377377
"tests.test_store.test_logging",
378378
"tests.test_store.test_object",
379379
"tests.test_store.test_stateful",

tests/test_store/test_core.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import tempfile
2+
from collections.abc import Callable, Coroutine
23
from pathlib import Path
34

45
import pytest
@@ -22,7 +23,7 @@
2223
@pytest.mark.parametrize("write_group", [True, False])
2324
@pytest.mark.parametrize("zarr_format", [2, 3])
2425
async def test_contains_group(
25-
local_store, path: str, write_group: bool, zarr_format: ZarrFormat
26+
local_store: LocalStore, path: str, write_group: bool, zarr_format: ZarrFormat
2627
) -> None:
2728
"""
2829
Test that the contains_group method correctly reports the existence of a group.
@@ -38,7 +39,7 @@ async def test_contains_group(
3839
@pytest.mark.parametrize("write_array", [True, False])
3940
@pytest.mark.parametrize("zarr_format", [2, 3])
4041
async def test_contains_array(
41-
local_store, path: str, write_array: bool, zarr_format: ZarrFormat
42+
local_store: LocalStore, path: str, write_array: bool, zarr_format: ZarrFormat
4243
) -> None:
4344
"""
4445
Test that the contains array method correctly reports the existence of an array.
@@ -51,13 +52,15 @@ async def test_contains_array(
5152

5253

5354
@pytest.mark.parametrize("func", [contains_array, contains_group])
54-
async def test_contains_invalid_format_raises(local_store, func: callable) -> None:
55+
async def test_contains_invalid_format_raises(
56+
local_store: LocalStore, func: Callable[[StorePath, ZarrFormat], Coroutine[None, None, bool]]
57+
) -> None:
5558
"""
5659
Test contains_group and contains_array raise errors for invalid zarr_formats
5760
"""
5861
store_path = StorePath(local_store)
5962
with pytest.raises(ValueError):
60-
assert await func(store_path, zarr_format="3.0")
63+
assert await func(store_path, "3.0") # type: ignore[arg-type]
6164

6265

6366
@pytest.mark.parametrize("path", [None, "", "bar"])
@@ -110,12 +113,12 @@ async def test_make_store_path_store_path(
110113

111114

112115
@pytest.mark.parametrize("modes", [(True, "w"), (False, "x")])
113-
async def test_store_path_invalid_mode_raises(tmpdir: LEGACY_PATH, modes: tuple) -> None:
116+
async def test_store_path_invalid_mode_raises(tmpdir: LEGACY_PATH, modes: tuple[bool, str]) -> None:
114117
"""
115118
Test that ValueErrors are raise for invalid mode.
116119
"""
117120
with pytest.raises(ValueError):
118-
await StorePath.open(LocalStore(str(tmpdir), read_only=modes[0]), path=None, mode=modes[1])
121+
await StorePath.open(LocalStore(str(tmpdir), read_only=modes[0]), path="", mode=modes[1]) # type: ignore[arg-type]
119122

120123

121124
async def test_make_store_path_invalid() -> None:
@@ -126,7 +129,7 @@ async def test_make_store_path_invalid() -> None:
126129
await make_store_path(1) # type: ignore[arg-type]
127130

128131

129-
async def test_make_store_path_fsspec(monkeypatch) -> None:
132+
async def test_make_store_path_fsspec() -> None:
130133
pytest.importorskip("fsspec")
131134
pytest.importorskip("requests")
132135
pytest.importorskip("aiohttp")
@@ -175,12 +178,12 @@ def test_normalize_path_upath() -> None:
175178
assert normalize_path(upath.UPath("foo/bar")) == "foo/bar"
176179

177180

178-
def test_normalize_path_none():
181+
def test_normalize_path_none() -> None:
179182
assert normalize_path(None) == ""
180183

181184

182185
@pytest.mark.parametrize("path", [".", ".."])
183-
def test_normalize_path_invalid(path: str):
186+
def test_normalize_path_invalid(path: str) -> None:
184187
with pytest.raises(ValueError):
185188
normalize_path(path)
186189

@@ -221,7 +224,7 @@ def test_invalid(paths: tuple[str, str]) -> None:
221224
_normalize_paths(paths)
222225

223226

224-
def test_normalize_path_keys():
227+
def test_normalize_path_keys() -> None:
225228
"""
226229
Test that ``_normalize_path_keys`` just applies the normalize_path function to each key of its
227230
input

0 commit comments

Comments
 (0)