Skip to content

Commit 90f8d55

Browse files
committed
write a test for apply_to_dataset on a DataArray
1 parent 5655571 commit 90f8d55

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

xarray/tests/test_dataarray.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,17 @@ def test_fillna(self):
26172617
actual = a.groupby("b").fillna(DataArray([0, 2], dims="b"))
26182618
assert_identical(expected, actual)
26192619

2620+
def test_apply_to_dataset(self):
2621+
def func(ds):
2622+
return Dataset(ds.data_vars, coords=ds.coords)
2623+
2624+
da = DataArray(
2625+
[[0, 1], [2, 3], [4, 5]],
2626+
dims=("x", "y"),
2627+
name="abc",
2628+
)
2629+
assert_identical(da, da.apply_to_dataset(func))
2630+
26202631
def test_groupby_iter(self):
26212632
for ((act_x, act_dv), (exp_x, exp_ds)) in zip(
26222633
self.dv.groupby("y"), self.ds.groupby("y")

0 commit comments

Comments
 (0)