@@ -47,7 +47,7 @@ def test_merge_datasets(self, use_new_combine_kwarg_defaults):
47
47
expected = data [["var1" , "var2" ]]
48
48
assert_identical (actual , expected )
49
49
50
- actual = xr .merge ([data , data ], compat = "no_conflicts" )
50
+ actual = xr .merge ([data , data ])
51
51
assert_identical (actual , data )
52
52
53
53
def test_merge_dataarray_unnamed (self ):
@@ -197,13 +197,9 @@ def test_merge_arrays_attrs_variables(
197
197
198
198
if expect_exception :
199
199
with pytest .raises (MergeError , match = "combine_attrs" ):
200
- actual = xr .merge (
201
- [data1 , data2 ], compat = "no_conflicts" , combine_attrs = combine_attrs
202
- )
200
+ actual = xr .merge ([data1 , data2 ], combine_attrs = combine_attrs )
203
201
else :
204
- actual = xr .merge (
205
- [data1 , data2 ], compat = "no_conflicts" , combine_attrs = combine_attrs
206
- )
202
+ actual = xr .merge ([data1 , data2 ], combine_attrs = combine_attrs )
207
203
expected = xr .Dataset (
208
204
{"var1" : ("dim1" , [], expected_attrs )},
209
205
coords = {"dim1" : ("dim1" , [], expected_attrs )},
@@ -323,19 +319,17 @@ def test_merge_no_conflicts_multi_var(self):
323
319
324
320
def test_merge_no_conflicts_preserve_attrs (self ):
325
321
data = xr .Dataset ({"x" : ([], 0 , {"foo" : "bar" })})
326
- actual = xr .merge (
327
- [data , data ], compat = "no_conflicts" , combine_attrs = "no_conflicts"
328
- )
322
+ actual = xr .merge ([data , data ], combine_attrs = "no_conflicts" )
329
323
assert_identical (data , actual )
330
324
331
325
def test_merge_no_conflicts_broadcast (self ):
332
326
datasets = [xr .Dataset ({"x" : ("y" , [0 ])}), xr .Dataset ({"x" : np .nan })]
333
- actual = xr .merge (datasets , compat = "no_conflicts" )
327
+ actual = xr .merge (datasets )
334
328
expected = xr .Dataset ({"x" : ("y" , [0 ])})
335
329
assert_identical (expected , actual )
336
330
337
331
datasets = [xr .Dataset ({"x" : ("y" , [np .nan ])}), xr .Dataset ({"x" : 0 })]
338
- actual = xr .merge (datasets , compat = "no_conflicts" )
332
+ actual = xr .merge (datasets )
339
333
assert_identical (expected , actual )
340
334
341
335
@@ -350,20 +344,20 @@ def test_merge(self):
350
344
351
345
actual = ds2 .merge (ds1 )
352
346
assert_identical (expected , actual )
353
- with pytest . warns ( FutureWarning ): # this is a false alarm
354
- actual = data .merge (data )
347
+
348
+ actual = data .merge (data )
355
349
assert_identical (data , actual )
356
- actual = data .reset_coords (drop = True ).merge (data , compat = "no_conflicts" )
350
+ actual = data .reset_coords (drop = True ).merge (data )
357
351
assert_identical (data , actual )
358
- actual = data .merge (data .reset_coords (drop = True ), compat = "no_conflicts" )
352
+ actual = data .merge (data .reset_coords (drop = True ))
359
353
assert_identical (data , actual )
360
354
361
355
with pytest .raises (ValueError , match = "conflicting values for variable" ):
362
356
ds1 .merge (ds2 .rename ({"var3" : "var1" }))
363
357
with pytest .raises (ValueError , match = r"should be coordinates or not" ):
364
- data .reset_coords ().merge (data , compat = "no_conflicts" )
358
+ data .reset_coords ().merge (data )
365
359
with pytest .raises (ValueError , match = r"should be coordinates or not" ):
366
- data .merge (data .reset_coords (), compat = "no_conflicts" )
360
+ data .merge (data .reset_coords ())
367
361
368
362
def test_merge_drop_attrs (self ):
369
363
data = create_test_data ()
@@ -417,6 +411,7 @@ def test_merge_compat(self):
417
411
assert ds1 .identical (ds1 .merge (ds2 , compat = "override" ))
418
412
419
413
def test_merge_compat_minimal (self ) -> None :
414
+ """Test that we drop the conflicting bar coordinate."""
420
415
# https://github.com/pydata/xarray/issues/7405
421
416
# https://github.com/pydata/xarray/issues/7588
422
417
ds1 = xr .Dataset (coords = {"foo" : [1 , 2 , 3 ], "bar" : 4 })
@@ -426,7 +421,7 @@ def test_merge_compat_minimal(self) -> None:
426
421
expected = xr .Dataset (coords = {"foo" : [1 , 2 , 3 ]})
427
422
assert_identical (actual , expected )
428
423
429
- def test_merge_join (self ):
424
+ def test_merge_join_outer (self ):
430
425
ds1 = xr .Dataset ({"a" : ("x" , [1 , 2 ]), "x" : [0 , 1 ]})
431
426
ds2 = xr .Dataset ({"b" : ("x" , [3 , 4 ]), "x" : [1 , 2 ]})
432
427
expected = xr .Dataset (
@@ -533,11 +528,7 @@ def test_merge_datasets_false_warning(self):
533
528
data = create_test_data (add_attrs = False , use_extension_array = True )
534
529
535
530
with set_options (use_new_combine_kwarg_defaults = False ):
536
- with pytest .warns (
537
- FutureWarning ,
538
- match = "will change from compat='no_conflicts' to compat='override'" ,
539
- ):
540
- old = xr .merge ([data , data ])
531
+ old = xr .merge ([data , data ])
541
532
542
533
with set_options (use_new_combine_kwarg_defaults = True ):
543
534
new = xr .merge ([data , data ])
@@ -571,11 +562,7 @@ def test_merge_broadcast_equals(self):
571
562
ds2 = xr .Dataset ({"x" : ("y" , [0 , 0 ])})
572
563
573
564
with set_options (use_new_combine_kwarg_defaults = False ):
574
- with pytest .warns (
575
- FutureWarning ,
576
- match = "will change from compat='no_conflicts' to compat='override'" ,
577
- ):
578
- old = ds1 .merge (ds2 )
565
+ old = ds1 .merge (ds2 )
579
566
580
567
with set_options (use_new_combine_kwarg_defaults = True ):
581
568
new = ds1 .merge (ds2 )
0 commit comments