8
8
9
9
from zarr .core .array import Array
10
10
from zarr .core .group import Group
11
+ from zarr .core .sync import sync
11
12
from zarr .storage import MemoryStore , StoreLike
12
13
13
14
# Copied from Xarray
@@ -42,7 +43,7 @@ def v2_dtypes() -> st.SearchStrategy[np.dtype]:
42
43
| npst .complex_number_dtypes (endianness = "=" )
43
44
| npst .byte_string_dtypes (endianness = "=" )
44
45
| npst .unicode_string_dtypes (endianness = "=" )
45
- | npst .datetime64_dtypes ()
46
+ | npst .datetime64_dtypes (endianness = "=" )
46
47
# | npst.timedelta64_dtypes()
47
48
)
48
49
@@ -62,7 +63,10 @@ def v2_dtypes() -> st.SearchStrategy[np.dtype]:
62
63
attrs = st .none () | st .dictionaries (_attr_keys , _attr_values )
63
64
keys = st .lists (node_names , min_size = 1 ).map ("/" .join )
64
65
paths = st .just ("/" ) | keys
65
- stores = st .builds (MemoryStore , st .just ({}), mode = st .just ("w" ))
66
+ # st.builds will only call a new store constructor for different keyword arguments
67
+ # i.e. stores.examples() will always return the same object per Store class.
68
+ # So we map a clear to reset the store.
69
+ stores = st .builds (MemoryStore , st .just ({})).map (lambda x : sync (x .clear ()))
66
70
compressors = st .sampled_from ([None , "default" ])
67
71
zarr_formats : st .SearchStrategy [Literal [2 , 3 ]] = st .sampled_from ([2 , 3 ])
68
72
array_shapes = npst .array_shapes (max_dims = 4 , min_side = 0 )
0 commit comments