Skip to content

Commit 0e678e5

Browse files
committed
Fix mypy in tests
1 parent e517dcc commit 0e678e5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

xarray/tests/test_concat.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,10 @@ def test_concat_coords(self, coords) -> None:
591591
data.isel(x=slice(5)).assign_coords(c=0),
592592
data.isel(x=slice(5, None)).assign_coords(c=1),
593593
]
594-
extra_kwargs = dict(compat="equals") if coords == "different" else {}
595-
actual = concat(objs, dim="x", coords=coords, **extra_kwargs)
594+
if coords == "different":
595+
actual = concat(objs, dim="x", coords=coords, compat="equals")
596+
else:
597+
actual = concat(objs, dim="x", coords=coords)
596598
assert_identical(expected, actual)
597599

598600
@pytest.mark.parametrize("coords", ["minimal", []])
@@ -611,8 +613,10 @@ def test_concat_constant_index(self, data_vars) -> None:
611613
ds1 = Dataset({"foo": 1.5}, {"y": 1})
612614
ds2 = Dataset({"foo": 2.5}, {"y": 1})
613615
expected = Dataset({"foo": ("y", [1.5, 2.5]), "y": [1, 1]})
614-
extra_kwargs = dict(compat="equals") if data_vars == "different" else {}
615-
actual = concat([ds1, ds2], "y", data_vars=data_vars, **extra_kwargs)
616+
if data_vars == "different":
617+
actual = concat([ds1, ds2], "y", data_vars=data_vars, compat="equals")
618+
else:
619+
actual = concat([ds1, ds2], "y", data_vars=data_vars)
616620
assert_identical(expected, actual)
617621

618622
def test_concat_constant_index_minimal_raises_merge_error(self) -> None:
@@ -677,13 +681,13 @@ def test_concat_errors(self) -> None:
677681
assert_identical(data, concat([data0, data1], "dim1", compat="equals"))
678682

679683
with pytest.raises(ValueError, match=r"compat.* invalid"):
680-
concat(split_data, "dim1", compat="foobar")
684+
concat(split_data, "dim1", compat="foobar") # type: ignore[call-overload]
681685

682686
with pytest.raises(ValueError, match=r"compat.* invalid"):
683687
concat(split_data, "dim1", compat="minimal")
684688

685689
with pytest.raises(ValueError, match=r"unexpected value for"):
686-
concat([data, data], "new_dim", coords="foobar")
690+
concat([data, data], "new_dim", coords="foobar") # type: ignore[call-overload]
687691

688692
with pytest.raises(
689693
ValueError, match=r"coordinate in some datasets but not others"

0 commit comments

Comments
 (0)