Skip to content

Commit 920f5b5

Browse files
committed
Demonstrate how merge can alter original object depending on join value
1 parent 0751b72 commit 920f5b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

xarray/tests/test_merge.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,16 @@ def test_merge(self):
352352
with pytest.raises(ValueError, match=r"should be coordinates or not"):
353353
data.merge(data.reset_coords())
354354

355-
def test_merge_drop_attrs(self):
355+
@pytest.mark.parametrize(
356+
"join", ["outer", "inner", "left", "right", "exact", "override"]
357+
)
358+
def test_merge_drop_attrs(self, join):
356359
data = create_test_data()
357360
ds1 = data[["var1"]]
358361
ds2 = data[["var3"]]
359362
ds1.coords["dim2"].attrs["keep me"] = "example"
360363
ds2.coords["numbers"].attrs["foo"] = "bar"
361-
actual = ds1.merge(ds2, combine_attrs="drop")
364+
actual = ds1.merge(ds2, combine_attrs="drop", join=join)
362365
assert actual.coords["dim2"].attrs == {}
363366
assert actual.coords["numbers"].attrs == {}
364367
assert ds1.coords["dim2"].attrs["keep me"] == "example"

0 commit comments

Comments
 (0)