Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update compat error checking to disallow "minimal" in concat() #9525

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
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'"
)
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 @@ -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")

Expand Down
Loading