File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Expand file tree Collapse file tree 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(
250250 shape = parse_shapelike (shape )
251251 codecs = list (codecs ) if codecs is not None else [BytesCodec ()]
252252
253- if fill_value is None :
254- if dtype == np .dtype ("bool" ):
255- fill_value = False
256- else :
257- fill_value = 0
258-
259253 if chunk_key_encoding is None :
260254 chunk_key_encoding = ("default" , "/" )
261255 assert chunk_key_encoding is not None
@@ -279,7 +273,6 @@ async def _create_v3(
279273 )
280274
281275 array = cls (metadata = metadata , store_path = store_path )
282-
283276 await array ._save_metadata (metadata )
284277 return array
285278
Original file line number Diff line number Diff line change @@ -464,6 +464,9 @@ def __repr__(self) -> str:
464464
465465 def all_equal (self , other : Any , equal_nan : bool = True ) -> bool :
466466 """Compare to `other` using np.array_equal."""
467+ if other is None :
468+ # Handle None fill_value for Zarr V2
469+ return False
467470 # use array_equal to obtain equal_nan=True functionality
468471 data , other = np .broadcast_arrays (self ._data , other )
469472 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(
322322 A scalar instance of `dtype`
323323 """
324324 if fill_value is None :
325- return dtype . type ( 0 ) # type: ignore[call-overload]
325+ fill_value = 0
326326 if isinstance (fill_value , Sequence ) and not isinstance (fill_value , str ):
327327 if dtype .type in (np .complex64 , np .complex128 ):
328328 dtype = cast (COMPLEX_DTYPE , dtype )
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ def arrays(
7474 path = draw (paths )
7575 name = draw (array_names )
7676 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 )]))
7879 # compressor = draw(compressors)
7980
8081 expected_attrs = {} if attributes is None else attributes
@@ -88,11 +89,12 @@ def arrays(
8889 chunks = chunks ,
8990 dtype = nparray .dtype ,
9091 attributes = attributes ,
91- # compressor=compressor, # TODO: FIXME
92+ # compressor=compressor, # FIXME
9293 fill_value = fill_value ,
9394 )
9495
9596 assert isinstance (a , Array )
97+ assert a .fill_value is not None
9698 assert isinstance (root [array_path ], Array )
9799 assert nparray .shape == a .shape
98100 assert chunks == a .chunks
You can’t perform that action at this time.
0 commit comments