diff --git a/xarray/core/concat.py b/xarray/core/concat.py index 182cf8a23a1..97c22578444 100644 --- a/xarray/core/concat.py +++ b/xarray/core/concat.py @@ -255,7 +255,7 @@ def concat( except StopIteration: raise ValueError("must supply at least one object to concatenate") - if compat not in _VALID_COMPAT: + if compat not in set(_VALID_COMPAT) - {"minimal"}: raise ValueError( f"compat={compat!r} invalid: must be 'broadcast_equals', 'equals', 'identical', 'no_conflicts' or 'override'" ) diff --git a/xarray/tests/test_concat.py b/xarray/tests/test_concat.py index e0dc105c925..dee890d285b 100644 --- a/xarray/tests/test_concat.py +++ b/xarray/tests/test_concat.py @@ -660,6 +660,9 @@ def test_concat_errors(self): with pytest.raises(ValueError, match=r"compat.* invalid"): concat(split_data, "dim1", compat="foobar") + with pytest.raises(ValueError, match=r"compat.* invalid"): + concat(split_data, "dim1", compat="minimal") + with pytest.raises(ValueError, match=r"unexpected value for"): concat([data, data], "new_dim", coords="foobar")