From 209086299685868171ec84e1a21654b74984b58c Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:05:47 +0000 Subject: [PATCH] update compat error checking --- xarray/core/concat.py | 2 +- xarray/tests/test_concat.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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..db46b363ac7 100644 --- a/xarray/tests/test_concat.py +++ b/xarray/tests/test_concat.py @@ -659,6 +659,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")