Skip to content

Commit

Permalink
Update compat error checking to disallow "minimal" in concat() (p…
Browse files Browse the repository at this point in the history
…ydata#9525)

* update compat error checking

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and hollymandel committed Sep 23, 2024
1 parent a27ab2b commit ede1e42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xarray/core/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def concat(
except StopIteration as err:
raise ValueError("must supply at least one object to concatenate") from err

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'"
)
Expand Down
3 changes: 3 additions & 0 deletions xarray/tests/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,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")

Expand Down

0 comments on commit ede1e42

Please sign in to comment.