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

Method test_merge_compat

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

Source from the content-addressed store, hash-verified

664 assert_identical(ds2, actual)
665
666 def test_merge_compat(self):
667 ds1 = xr.Dataset({"x": 0})
668 ds2 = xr.Dataset({"x": 1})
669 for compat in ["broadcast_equals", "equals", "identical", "no_conflicts"]:
670 with pytest.raises(xr.MergeError):
671 ds1.merge(ds2, compat=compat) # type: ignore[arg-type]
672
673 ds2 = xr.Dataset({"x": [0, 0]})
674 for compat in ["equals", "identical"]:
675 with pytest.raises(ValueError, match=r"should be coordinates or not"):
676 ds1.merge(ds2, compat=compat) # type: ignore[arg-type]
677
678 ds2 = xr.Dataset({"x": ((), 0, {"foo": "bar"})})
679 with pytest.raises(xr.MergeError):
680 ds1.merge(ds2, compat="identical")
681
682 with pytest.raises(ValueError, match=r"compat=.* invalid"):
683 ds1.merge(ds2, compat="foobar") # type: ignore[arg-type]
684
685 assert ds1.identical(ds1.merge(ds2, compat="override"))
686
687 def test_merge_compat_minimal(self) -> None:
688 """Test that we drop the conflicting bar coordinate."""

Callers

nothing calls this directly

Calls 2

mergeMethod · 0.95
identicalMethod · 0.95

Tested by

no test coverage detected