Skip to content

Commit 2b800ba

Browse files
Update compat error checking to disallow "minimal" in concat() (#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>
1 parent 3c74509 commit 2b800ba

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

xarray/core/concat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def concat(
255255
except StopIteration as err:
256256
raise ValueError("must supply at least one object to concatenate") from err
257257

258-
if compat not in _VALID_COMPAT:
258+
if compat not in set(_VALID_COMPAT) - {"minimal"}:
259259
raise ValueError(
260260
f"compat={compat!r} invalid: must be 'broadcast_equals', 'equals', 'identical', 'no_conflicts' or 'override'"
261261
)

xarray/tests/test_concat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,9 @@ def test_concat_errors(self):
663663
with pytest.raises(ValueError, match=r"compat.* invalid"):
664664
concat(split_data, "dim1", compat="foobar")
665665

666+
with pytest.raises(ValueError, match=r"compat.* invalid"):
667+
concat(split_data, "dim1", compat="minimal")
668+
666669
with pytest.raises(ValueError, match=r"unexpected value for"):
667670
concat([data, data], "new_dim", coords="foobar")
668671

0 commit comments

Comments
 (0)