Skip to content

Commit 0b99b85

Browse files
committed
Bring back some warnings
1 parent 301dc22 commit 0b99b85

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

xarray/tests/test_merge.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,15 @@ def test_merge_arrays_attrs_variables(
197197

198198
if expect_exception:
199199
with pytest.raises(MergeError, match="combine_attrs"):
200-
actual = xr.merge([data1, data2], combine_attrs=combine_attrs)
200+
with pytest.warns(
201+
FutureWarning,
202+
match="will change from compat='no_conflicts' to compat='override'",
203+
):
204+
actual = xr.merge([data1, data2], combine_attrs=combine_attrs)
201205
else:
202-
actual = xr.merge([data1, data2], combine_attrs=combine_attrs)
206+
actual = xr.merge(
207+
[data1, data2], compat="no_conflicts", combine_attrs=combine_attrs
208+
)
203209
expected = xr.Dataset(
204210
{"var1": ("dim1", [], expected_attrs)},
205211
coords={"dim1": ("dim1", [], expected_attrs)},
@@ -324,12 +330,12 @@ def test_merge_no_conflicts_preserve_attrs(self):
324330

325331
def test_merge_no_conflicts_broadcast(self):
326332
datasets = [xr.Dataset({"x": ("y", [0])}), xr.Dataset({"x": np.nan})]
327-
actual = xr.merge(datasets)
333+
actual = xr.merge(datasets, compat="no_conflicts")
328334
expected = xr.Dataset({"x": ("y", [0])})
329335
assert_identical(expected, actual)
330336

331337
datasets = [xr.Dataset({"x": ("y", [np.nan])}), xr.Dataset({"x": 0})]
332-
actual = xr.merge(datasets)
338+
actual = xr.merge(datasets, compat="no_conflicts")
333339
assert_identical(expected, actual)
334340

335341

@@ -562,7 +568,11 @@ def test_merge_broadcast_equals(self):
562568
ds2 = xr.Dataset({"x": ("y", [0, 0])})
563569

564570
with set_options(use_new_combine_kwarg_defaults=False):
565-
old = ds1.merge(ds2)
571+
with pytest.warns(
572+
FutureWarning,
573+
match="will change from compat='no_conflicts' to compat='override'",
574+
):
575+
old = ds1.merge(ds2)
566576

567577
with set_options(use_new_combine_kwarg_defaults=True):
568578
new = ds1.merge(ds2)

0 commit comments

Comments
 (0)