Skip to content

Commit

Permalink
Fix tests using null fill value or nan fill value for integer dat…
Browse files Browse the repository at this point in the history
…a type
  • Loading branch information
LDeakin committed Oct 6, 2024
1 parent d96c8a4 commit 66bd819
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion virtualizarr/tests/test_kerchunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_kerchunk_roundtrip_in_memory_no_concat():
chunks=(2, 2),
compressor=None,
filters=None,
fill_value=np.nan,
fill_value=0,
order="C",
),
chunkmanifest=manifest,
Expand Down
6 changes: 3 additions & 3 deletions virtualizarr/tests/test_manifests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_create_manifestarray(self):

def test_create_manifestarray_from_kerchunk_refs(self):
arr_refs = {
".zarray": '{"chunks":[2,3],"compressor":null,"dtype":"<i8","fill_value":null,"filters":null,"order":"C","shape":[2,3],"zarr_format":2}',
".zarray": '{"chunks":[2,3],"compressor":null,"dtype":"<i8","fill_value":0,"filters":null,"order":"C","shape":[2,3],"zarr_format":2}',
"0.0": ["test1.nc", 6144, 48],
}
marr = ManifestArray._from_kerchunk_refs(arr_refs)
Expand All @@ -46,13 +46,13 @@ def test_create_manifestarray_from_kerchunk_refs(self):
assert marr.chunks == (2, 3)
assert marr.dtype == np.dtype("int64")
assert marr.zarray.compressor is None
assert marr.zarray.fill_value is np.nan
assert marr.zarray.fill_value is 0
assert marr.zarray.filters is None
assert marr.zarray.order == "C"

def test_create_scalar_manifestarray_from_kerchunk_refs(self):
arr_refs = {
".zarray": '{"chunks":[],"compressor":null,"dtype":"<i8","fill_value":null,"filters":null,"order":"C","shape":[],"zarr_format":2}',
".zarray": '{"chunks":[],"compressor":null,"dtype":"<i8","fill_value":0,"filters":null,"order":"C","shape":[],"zarr_format":2}',
"0": ["test1.nc", 6144, 48],
}
marr = ManifestArray._from_kerchunk_refs(arr_refs)
Expand Down
2 changes: 1 addition & 1 deletion virtualizarr/tests/test_readers/test_kerchunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_dataset_from_df_refs():

assert da.data.zarray.compressor is None
assert da.data.zarray.filters is None
assert da.data.zarray.fill_value is np.nan
assert da.data.zarray.fill_value is 0
assert da.data.zarray.order == "C"

assert da.data.manifest.dict() == {
Expand Down
8 changes: 4 additions & 4 deletions virtualizarr/tests/test_writers/test_kerchunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_accessor_to_kerchunk_dict(self):
chunks=(2, 3),
compressor=None,
filters=None,
fill_value=np.nan,
fill_value=0,
order="C",
),
)
Expand All @@ -30,7 +30,7 @@ def test_accessor_to_kerchunk_dict(self):
"refs": {
".zgroup": '{"zarr_format":2}',
".zattrs": "{}",
"a/.zarray": '{"shape":[2,3],"chunks":[2,3],"dtype":"<i8","fill_value":null,"order":"C","compressor":null,"filters":null,"zarr_format":2}',
"a/.zarray": '{"shape":[2,3],"chunks":[2,3],"dtype":"<i8","fill_value":0,"order":"C","compressor":null,"filters":null,"zarr_format":2}',
"a/.zattrs": '{"_ARRAY_DIMENSIONS":["x","y"]}',
"a/0.0": ["test.nc", 6144, 48],
},
Expand All @@ -51,7 +51,7 @@ def test_accessor_to_kerchunk_json(self, tmp_path):
chunks=(2, 3),
compressor=None,
filters=None,
fill_value=np.nan,
fill_value=0,
order="C",
),
)
Expand All @@ -69,7 +69,7 @@ def test_accessor_to_kerchunk_json(self, tmp_path):
"refs": {
".zgroup": '{"zarr_format":2}',
".zattrs": "{}",
"a/.zarray": '{"shape":[2,3],"chunks":[2,3],"dtype":"<i8","fill_value":null,"order":"C","compressor":null,"filters":null,"zarr_format":2}',
"a/.zarray": '{"shape":[2,3],"chunks":[2,3],"dtype":"<i8","fill_value":0,"order":"C","compressor":null,"filters":null,"zarr_format":2}',
"a/.zattrs": '{"_ARRAY_DIMENSIONS":["x","y"]}',
"a/0.0": ["test.nc", 6144, 48],
},
Expand Down

0 comments on commit 66bd819

Please sign in to comment.