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 1/2] 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") From 488d4c40566547b1605095e66d19ba57b90b55df Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:14:19 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/tests/test_concat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/tests/test_concat.py b/xarray/tests/test_concat.py index db46b363ac7..dee890d285b 100644 --- a/xarray/tests/test_concat.py +++ b/xarray/tests/test_concat.py @@ -659,7 +659,7 @@ 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")