Skip to content

Commit

Permalink
Add failing test when saving complex dtypes to disk.
Browse files Browse the repository at this point in the history
  • Loading branch information
atrabattoni committed Jan 8, 2025
1 parent bca92b5 commit 571c8a8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ def test_all(self):
)
assert da1.equals(da2)

def test_dtypes(self, tmp_path):
dtypes = (
np.uint8,
np.uint16,
np.uint32,
np.uint64,
np.int8,
np.int16,
np.int32,
np.int64,
np.float16,
np.float32,
np.float64,
np.complex64,
np.complex128,
)
for dtype in dtypes:
expected = xdas.DataArray(np.zeros((3, 5), dtype=dtype))
expected.to_netcdf(tmp_path / "data.nc")
result = xdas.open_dataarray(tmp_path / "data.nc")
assert result.equals(expected)


def array_identical(x, y):
return (
Expand Down

0 comments on commit 571c8a8

Please sign in to comment.