File tree 4 files changed +8
-10
lines changed 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -250,12 +250,6 @@ async def _create_v3(
250
250
shape = parse_shapelike (shape )
251
251
codecs = list (codecs ) if codecs is not None else [BytesCodec ()]
252
252
253
- if fill_value is None :
254
- if dtype == np .dtype ("bool" ):
255
- fill_value = False
256
- else :
257
- fill_value = 0
258
-
259
253
if chunk_key_encoding is None :
260
254
chunk_key_encoding = ("default" , "/" )
261
255
assert chunk_key_encoding is not None
@@ -279,7 +273,6 @@ async def _create_v3(
279
273
)
280
274
281
275
array = cls (metadata = metadata , store_path = store_path )
282
-
283
276
await array ._save_metadata (metadata )
284
277
return array
285
278
Original file line number Diff line number Diff line change @@ -464,6 +464,9 @@ def __repr__(self) -> str:
464
464
465
465
def all_equal (self , other : Any , equal_nan : bool = True ) -> bool :
466
466
"""Compare to `other` using np.array_equal."""
467
+ if other is None :
468
+ # Handle None fill_value for Zarr V2
469
+ return False
467
470
# use array_equal to obtain equal_nan=True functionality
468
471
data , other = np .broadcast_arrays (self ._data , other )
469
472
result = np .array_equal (self ._data , other , equal_nan = equal_nan )
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ def parse_fill_value(
322
322
A scalar instance of `dtype`
323
323
"""
324
324
if fill_value is None :
325
- return dtype . type ( 0 ) # type: ignore[call-overload]
325
+ fill_value = 0
326
326
if isinstance (fill_value , Sequence ) and not isinstance (fill_value , str ):
327
327
if dtype .type in (np .complex64 , np .complex128 ):
328
328
dtype = cast (COMPLEX_DTYPE , dtype )
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ def arrays(
74
74
path = draw (paths )
75
75
name = draw (array_names )
76
76
attributes = draw (attrs )
77
- fill_value = draw (npst .from_dtype (nparray .dtype ))
77
+ # test that None works too.
78
+ fill_value = draw (st .one_of ([st .none (), npst .from_dtype (nparray .dtype )]))
78
79
# compressor = draw(compressors)
79
80
80
81
expected_attrs = {} if attributes is None else attributes
@@ -88,11 +89,12 @@ def arrays(
88
89
chunks = chunks ,
89
90
dtype = nparray .dtype ,
90
91
attributes = attributes ,
91
- # compressor=compressor, # TODO: FIXME
92
+ # compressor=compressor, # FIXME
92
93
fill_value = fill_value ,
93
94
)
94
95
95
96
assert isinstance (a , Array )
97
+ assert a .fill_value is not None
96
98
assert isinstance (root [array_path ], Array )
97
99
assert nparray .shape == a .shape
98
100
assert chunks == a .chunks
You can’t perform that action at this time.
0 commit comments