Skip to content

Commit

Permalink
Fails test when a warning is raised for calling np.array() on an xr.D…
Browse files Browse the repository at this point in the history
…ataArray
  • Loading branch information
andrew-s28 committed Aug 22, 2024
1 parent 86a573c commit 77a79d5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xarray/tests/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -7065,6 +7065,14 @@ def test_from_numpy(self) -> None:
np.testing.assert_equal(da.to_numpy(), np.array([1, 2, 3]))
np.testing.assert_equal(da["lat"].to_numpy(), np.array([4, 5, 6]))

def test_to_numpy(self) -> None:
arr = np.array([1, 2, 3])
da = xr.DataArray(arr, dims="x", coords={"lat": ("x", [4, 5, 6])})

with assert_no_warnings():
np.testing.assert_equal(np.asarray(da), arr)
np.testing.assert_equal(np.array(da), arr)

@requires_dask
def test_from_dask(self) -> None:
da = xr.DataArray([1, 2, 3], dims="x", coords={"lat": ("x", [4, 5, 6])})
Expand Down

0 comments on commit 77a79d5

Please sign in to comment.