11from __future__ import annotations
22
3- from typing import TYPE_CHECKING
3+ from typing import TYPE_CHECKING , get_args
44
55if TYPE_CHECKING :
66 import pathlib
@@ -68,13 +68,16 @@ def test_create(memory_store: Store) -> None:
6868 z = create (shape = (400 , 100 ), chunks = (16 , 16.5 ), store = store , overwrite = True ) # type: ignore [arg-type]
6969
7070
71- @pytest .mark .parametrize ("func_name" , ["zeros_like" , "ones_like" , "empty_like" , "full_like" ])
71+ LikeFuncName = Literal ["zeros_like" , "ones_like" , "empty_like" , "full_like" , "open_like" ]
72+
73+
74+ @pytest .mark .parametrize ("func_name" , get_args (LikeFuncName ))
7275@pytest .mark .parametrize ("out_shape" , ["keep" , (10 , 10 )])
7376@pytest .mark .parametrize ("out_chunks" , ["keep" , (10 , 10 )])
7477@pytest .mark .parametrize ("out_dtype" , ["keep" , "int8" ])
7578async def test_array_like_creation (
7679 zarr_format : ZarrFormat ,
77- func_name : str ,
80+ func_name : LikeFuncName ,
7881 out_shape : Literal ["keep" ] | tuple [int , ...],
7982 out_chunks : Literal ["keep" ] | tuple [int , ...],
8083 out_dtype : str ,
@@ -101,6 +104,10 @@ async def test_array_like_creation(
101104 elif func_name == "empty_like" :
102105 expect_fill = ref_arr .fill_value
103106 func = zarr .api .asynchronous .empty_like
107+ elif func_name == "open_like" :
108+ expect_fill = ref_arr .fill_value
109+ kwargs ["mode" ] = "w"
110+ func = zarr .api .asynchronous .open_like # type: ignore[assignment]
104111 else :
105112 raise AssertionError
106113 if out_shape != "keep" :
0 commit comments