MCPcopy
hub / github.com/pydata/xarray / test_merge_auto_align

Method test_merge_auto_align

xarray/tests/test_merge.py:852–870  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

850 assert_identical(old, new)
851
852 def test_merge_auto_align(self):
853 ds1 = xr.Dataset({"a": ("x", [1, 2]), "x": [0, 1]})
854 ds2 = xr.Dataset({"b": ("x", [3, 4]), "x": [1, 2]})
855 expected = xr.Dataset(
856 {"a": ("x", [1, 2, np.nan]), "b": ("x", [np.nan, 3, 4])}, {"x": [0, 1, 2]}
857 )
858 with set_options(use_new_combine_kwarg_defaults=False):
859 with pytest.warns(
860 FutureWarning, match="will change from join='outer' to join='exact'"
861 ):
862 assert expected.identical(ds1.merge(ds2))
863 with pytest.warns(
864 FutureWarning, match="will change from join='outer' to join='exact'"
865 ):
866 assert expected.identical(ds2.merge(ds1))
867
868 with set_options(use_new_combine_kwarg_defaults=True):
869 with pytest.raises(ValueError, match="might be related to new default"):
870 expected.identical(ds2.merge(ds1))
871
872
873class TestMergeDataTree:

Callers

nothing calls this directly

Calls 3

identicalMethod · 0.95
mergeMethod · 0.95
set_optionsClass · 0.90

Tested by

no test coverage detected