88
99from zarr .core .array import Array
1010from zarr .core .group import Group
11+ from zarr .core .sync import sync
1112from zarr .storage import MemoryStore , StoreLike
1213
1314# Copied from Xarray
@@ -42,7 +43,7 @@ def v2_dtypes() -> st.SearchStrategy[np.dtype]:
4243 | npst .complex_number_dtypes (endianness = "=" )
4344 | npst .byte_string_dtypes (endianness = "=" )
4445 | npst .unicode_string_dtypes (endianness = "=" )
45- | npst .datetime64_dtypes ()
46+ | npst .datetime64_dtypes (endianness = "=" )
4647 # | npst.timedelta64_dtypes()
4748 )
4849
@@ -62,7 +63,10 @@ def v2_dtypes() -> st.SearchStrategy[np.dtype]:
6263attrs = st .none () | st .dictionaries (_attr_keys , _attr_values )
6364keys = st .lists (node_names , min_size = 1 ).map ("/" .join )
6465paths = 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 ()))
6670compressors = st .sampled_from ([None , "default" ])
6771zarr_formats : st .SearchStrategy [Literal [2 , 3 ]] = st .sampled_from ([2 , 3 ])
6872array_shapes = npst .array_shapes (max_dims = 4 , min_side = 0 )
0 commit comments