Skip to content

Commit e31cb6f

Browse files
committed
Fixes
1 parent efcf1f5 commit e31cb6f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/zarr/core/metadata/v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def parse_fill_value(
391391
pass
392392
elif fill_value in ["Infinity", "-Infinity"] and not np.isfinite(casted_value):
393393
pass
394-
elif dtype.kind == "f":
394+
elif dtype.kind in "cf":
395395
# float comparison is not exact, especially when dtype <float64
396396
# so we us np.isclose for this comparison.
397397
# this also allows us to compare nan fill_values

src/zarr/testing/strategies.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@
1818
max_leaves=3,
1919
)
2020

21+
22+
def dtypes() -> st.SearchStrategy[np.dtype]:
23+
return (
24+
npst.integer_dtypes(endianness="=")
25+
| npst.unsigned_integer_dtypes(endianness="=")
26+
| npst.floating_dtypes(endianness="=")
27+
| npst.complex_number_dtypes(endianness="=")
28+
# | npst.unicode_string_dtypes()
29+
# | npst.datetime64_dtypes()
30+
# | npst.timedelta64_dtypes()
31+
)
32+
33+
2134
# From https://zarr-specs.readthedocs.io/en/latest/v3/core/v3.0.html#node-names
2235
# 1. must not be the empty string ("")
2336
# 2. must not include the character "/"
@@ -33,10 +46,7 @@
3346
attrs = st.none() | st.dictionaries(_attr_keys, _attr_values)
3447
paths = st.lists(node_names, min_size=1).map(lambda x: "/".join(x)) | st.just("/")
3548
np_arrays = npst.arrays(
36-
# TODO: re-enable timedeltas once they are supported
37-
dtype=npst.scalar_dtypes().filter(
38-
lambda x: (x.kind not in ["m", "M"]) and (x.byteorder not in [">"])
39-
),
49+
dtype=dtypes(),
4050
shape=npst.array_shapes(max_dims=4),
4151
)
4252
stores = st.builds(MemoryStore, st.just({}), mode=st.just("w"))

0 commit comments

Comments
 (0)