Skip to content

Commit e99fc36

Browse files
committed
Demonstrate how merge can alter original object depending on join value
1 parent d237a71 commit e99fc36

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
@@ -365,13 +365,16 @@ def test_merge(self):
365365
with pytest.raises(ValueError, match=r"should be coordinates or not"):
366366
data.merge(data.reset_coords())
367367

368-
def test_merge_drop_attrs(self):
368+
@pytest.mark.parametrize(
369+
"join", ["outer", "inner", "left", "right", "exact", "override"]
370+
)
371+
def test_merge_drop_attrs(self, join):
369372
data = create_test_data()
370373
ds1 = data[["var1"]]
371374
ds2 = data[["var3"]]
372375
ds1.coords["dim2"].attrs["keep me"] = "example"
373376
ds2.coords["numbers"].attrs["foo"] = "bar"
374-
actual = ds1.merge(ds2, combine_attrs="drop")
377+
actual = ds1.merge(ds2, combine_attrs="drop", join=join)
375378
assert actual.coords["dim2"].attrs == {}
376379
assert actual.coords["numbers"].attrs == {}
377380
assert ds1.coords["dim2"].attrs["keep me"] == "example"

0 commit comments

Comments
 (0)