Ensure exception on bounds error is raised if requested
()
| 1016 | |
| 1017 | @requires_scipy |
| 1018 | def test_interp1d_bounds_error() -> None: |
| 1019 | """Ensure exception on bounds error is raised if requested""" |
| 1020 | da = xr.DataArray( |
| 1021 | np.sin(0.3 * np.arange(4)), |
| 1022 | [("time", np.arange(4))], |
| 1023 | ) |
| 1024 | |
| 1025 | with pytest.raises(ValueError): |
| 1026 | da.interp(time=3.5, kwargs=dict(bounds_error=True)) |
| 1027 | |
| 1028 | # default is to fill with nans, so this should pass |
| 1029 | da.interp(time=3.5) |
| 1030 | |
| 1031 | |
| 1032 | @requires_scipy |