Skip to content

Commit f3d7414

Browse files
committed
Add DataArray().drop_attrs() tests
1 parent e9e59cd commit f3d7414

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xarray/tests/test_dataarray.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2991,8 +2991,11 @@ def test_assign_attrs(self) -> None:
29912991

29922992
def test_drop_attrs(self) -> None:
29932993
# Mostly tested in test_dataset.py, but adding a very small test here
2994-
da = DataArray([], attrs=dict(a=1, b=2))
2994+
coord_ = xr.DataArray([], attrs=dict(d=3, e=4))
2995+
da = DataArray([], attrs=dict(a=1, b=2)).assign_coords(dict(coord_=coord_))
29952996
assert da.drop_attrs().attrs == {}
2997+
assert da.drop_attrs().coord_.attrs == {}
2998+
assert da.drop_attrs(deep=False).coord_.attrs == dict(d=3, e=4)
29962999

29973000
@pytest.mark.parametrize(
29983001
"func", [lambda x: x.clip(0, 1), lambda x: np.float64(1.0) * x, np.abs, abs]

0 commit comments

Comments
 (0)