File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -252,12 +252,6 @@ async def _create_v3(
252252 shape = parse_shapelike (shape )
253253 codecs = list (codecs ) if codecs is not None else [BytesCodec ()]
254254
255- if fill_value is None :
256- if dtype == np .dtype ("bool" ):
257- fill_value = False
258- else :
259- fill_value = 0
260-
261255 if chunk_key_encoding is None :
262256 chunk_key_encoding = ("default" , "/" )
263257 assert chunk_key_encoding is not None
@@ -281,7 +275,6 @@ async def _create_v3(
281275 )
282276
283277 array = cls (metadata = metadata , store_path = store_path )
284-
285278 await array ._save_metadata (metadata )
286279 return array
287280
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 @@ -79,7 +79,8 @@ def arrays(
7979 name = draw (array_names )
8080 attributes = draw (attrs )
8181 zarr_format = draw (zarr_formats )
82- fill_value = draw (npst .from_dtype (nparray .dtype ))
82+ # test that None works too.
83+ fill_value = draw (st .one_of ([st .none (), npst .from_dtype (nparray .dtype )]))
8384 # compressor = draw(compressors)
8485
8586 expected_attrs = {} if attributes is None else attributes
@@ -93,11 +94,12 @@ def arrays(
9394 chunks = chunks ,
9495 dtype = nparray .dtype ,
9596 attributes = attributes ,
96- # compressor=compressor, # TODO: FIXME
97+ # compressor=compressor, # FIXME
9798 fill_value = fill_value ,
9899 )
99100
100101 assert isinstance (a , Array )
102+ assert a .fill_value is not None
101103 assert isinstance (root [array_path ], Array )
102104 assert nparray .shape == a .shape
103105 assert chunks == a .chunks
You can’t perform that action at this time.
0 commit comments