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,19 @@ 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 ,
1325
+ create_function : Callable , # type:ignore[type-arg]
1326
+ overwrite : bool ,
1327
+ ) -> None :
1329
1328
store = zarr .storage .LocalStore (tmp_path )
1330
1329
existing_fpath = add_empty_file (tmp_path )
1331
1330
@@ -1339,7 +1338,11 @@ def test_no_overwrite_array(tmp_path: Path, create_function: Callable, overwrite
1339
1338
1340
1339
@pytest .mark .parametrize ("create_function" , [create_group , group ])
1341
1340
@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]
1341
+ def test_no_overwrite_group (
1342
+ tmp_path : pathlib .Path ,
1343
+ create_function : Callable , # type:ignore[type-arg]
1344
+ overwrite : bool ,
1345
+ ) -> None :
1343
1346
store = zarr .storage .LocalStore (tmp_path )
1344
1347
existing_fpath = add_empty_file (tmp_path )
1345
1348
@@ -1353,7 +1356,7 @@ def test_no_overwrite_group(tmp_path: Path, create_function: Callable, overwrite
1353
1356
1354
1357
@pytest .mark .parametrize ("open_func" , [zarr .open , open_group ])
1355
1358
@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]
1359
+ def test_no_overwrite_open (tmp_path : pathlib . Path , open_func : Callable , mode : str ) -> None : # type:ignore[type-arg]
1357
1360
store = zarr .storage .LocalStore (tmp_path )
1358
1361
existing_fpath = add_empty_file (tmp_path )
1359
1362
@@ -1366,7 +1369,7 @@ def test_no_overwrite_open(tmp_path: Path, open_func: Callable, mode: str) -> No
1366
1369
assert existing_fpath .exists ()
1367
1370
1368
1371
1369
- def test_no_overwrite_load (tmp_path : Path ) -> None :
1372
+ def test_no_overwrite_load (tmp_path : pathlib . Path ) -> None :
1370
1373
store = zarr .storage .LocalStore (tmp_path )
1371
1374
existing_fpath = add_empty_file (tmp_path )
1372
1375
0 commit comments