1
1
from __future__ import annotations
2
2
3
3
import inspect
4
- import pathlib
5
4
import re
6
5
from typing import TYPE_CHECKING
7
6
46
45
from zarr .storage ._utils import normalize_path
47
46
from zarr .testing .utils import gpu_test
48
47
49
- if TYPE_CHECKING :
50
- from collections .abc import Callable
51
- from pathlib import Path
52
-
53
48
54
49
def test_create (memory_store : Store ) -> None :
55
50
store = memory_store
@@ -1317,15 +1312,17 @@ def test_v2_with_v3_compressor() -> None:
1317
1312
)
1318
1313
1319
1314
1320
- def add_empty_file (path : Path ) -> Path :
1315
+ def add_empty_file (path : pathlib . Path ) -> pathlib . Path :
1321
1316
fpath = path / "a.txt"
1322
1317
fpath .touch ()
1323
1318
return fpath
1324
1319
1325
1320
1326
1321
@pytest .mark .parametrize ("create_function" , [create_array , from_array ])
1327
1322
@pytest .mark .parametrize ("overwrite" , [True , False ])
1328
- def test_no_overwrite_array (tmp_path : Path , create_function : Callable , overwrite : bool ) -> None : # type:ignore[type-arg]
1323
+ def test_no_overwrite_array (
1324
+ tmp_path : pathlib .Path , create_function : Callable , overwrite : bool # type:ignore[type-arg]
1325
+ ) -> None :
1329
1326
store = zarr .storage .LocalStore (tmp_path )
1330
1327
existing_fpath = add_empty_file (tmp_path )
1331
1328
@@ -1339,7 +1336,9 @@ def test_no_overwrite_array(tmp_path: Path, create_function: Callable, overwrite
1339
1336
1340
1337
@pytest .mark .parametrize ("create_function" , [create_group , group ])
1341
1338
@pytest .mark .parametrize ("overwrite" , [True , False ])
1342
- def test_no_overwrite_group (tmp_path : Path , create_function : Callable , overwrite : bool ) -> None : # type:ignore[type-arg]
1339
+ def test_no_overwrite_group (
1340
+ tmp_path : pathlib .Path , create_function : Callable , overwrite : bool # type:ignore[type-arg]
1341
+ ) -> None :
1343
1342
store = zarr .storage .LocalStore (tmp_path )
1344
1343
existing_fpath = add_empty_file (tmp_path )
1345
1344
@@ -1353,7 +1352,7 @@ def test_no_overwrite_group(tmp_path: Path, create_function: Callable, overwrite
1353
1352
1354
1353
@pytest .mark .parametrize ("open_func" , [zarr .open , open_group ])
1355
1354
@pytest .mark .parametrize ("mode" , ["r" , "r+" , "a" , "w" , "w-" ])
1356
- def test_no_overwrite_open (tmp_path : Path , open_func : Callable , mode : str ) -> None : # type:ignore[type-arg]
1355
+ def test_no_overwrite_open (tmp_path : pathlib . Path , open_func : Callable , mode : str ) -> None : # type:ignore[type-arg]
1357
1356
store = zarr .storage .LocalStore (tmp_path )
1358
1357
existing_fpath = add_empty_file (tmp_path )
1359
1358
@@ -1366,7 +1365,7 @@ def test_no_overwrite_open(tmp_path: Path, open_func: Callable, mode: str) -> No
1366
1365
assert existing_fpath .exists ()
1367
1366
1368
1367
1369
- def test_no_overwrite_load (tmp_path : Path ) -> None :
1368
+ def test_no_overwrite_load (tmp_path : pathlib . Path ) -> None :
1370
1369
store = zarr .storage .LocalStore (tmp_path )
1371
1370
existing_fpath = add_empty_file (tmp_path )
1372
1371
0 commit comments