diff --git a/xarray/tests/test_interp.py b/xarray/tests/test_interp.py index 63ea59c9125..86532a26f65 100644 --- a/xarray/tests/test_interp.py +++ b/xarray/tests/test_interp.py @@ -1058,7 +1058,28 @@ def test_interp1d_complex_out_of_bounds() -> None: @requires_scipy -def test_interp_non_numeric() -> None: +def test_interp_non_numeric_1d() -> None: + ds = xr.Dataset( + { + "numeric": ("time", 1 + np.arange(0, 4, 1)), + "non_numeric": ("time", np.array(["a", "b", "c", "d"])), + }, + coords={"time": (np.arange(0, 4, 1))}, + ) + actual = ds.interp(time=np.linspace(0, 3, 7)) + + expected = xr.Dataset( + { + "numeric": ("time", 1 + np.linspace(0, 3, 7)), + "non_numeric": ("time", np.array(["a", "b", "b", "c", "c", "d", "d"])), + }, + coords={"time": np.linspace(0, 3, 7)}, + ) + xr.testing.assert_identical(actual, expected) + + +@requires_scipy +def test_interp_non_numeric_nd() -> None: # regression test for GH8099, GH9839 ds = xr.Dataset({"x": ("a", np.arange(4))}, coords={"a": (np.arange(4) - 1.5)}) t = xr.DataArray(