Skip to content

Commit b89bf89

Browse files
authored
Fix TestDataArray.test_curvefit_helpers and TestIndexVariable.test_concat_periods (#11204)
* Filter deprecated warning * Remove inspect.signature raises error test. The example no longer raises an error * Type of error changed in numpy 2.4
1 parent 9d8c615 commit b89bf89

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

xarray/core/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ def get_valid_numpy_dtype(array: np.ndarray | pd.Index) -> np.dtype:
205205

206206

207207
def maybe_coerce_to_str(index, original_coords):
208-
"""maybe coerce a pandas Index back to a nunpy array of type str
208+
"""maybe coerce a pandas Index back to a numpy array of type str
209209
210210
pd.Index uses object-dtype to store str - try to avoid this for coords
211211
"""
212212
from xarray.core import dtypes
213213

214214
try:
215215
result_type = dtypes.result_type(*original_coords)
216-
except TypeError:
216+
except (TypeError, ValueError):
217217
pass
218218
else:
219219
if result_type.kind in "SU":

xarray/tests/test_computation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,6 +2646,7 @@ def test_complex_number_reduce(compute_backend):
26462646
da.min()
26472647

26482648

2649+
@pytest.mark.filterwarnings("ignore:numpy.fix is deprecated.")
26492650
def test_fix() -> None:
26502651
val = 3.0
26512652
val_fixed = np.fix(val)

xarray/tests/test_dataarray.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4908,8 +4908,6 @@ def exp_decay(t, n0, tau=1):
49084908
param_names = ["a"]
49094909
params, func_args = _get_func_args(np.power, param_names)
49104910
assert params == param_names
4911-
with pytest.raises(ValueError):
4912-
_get_func_args(np.power, [])
49134911

49144912
@requires_scipy
49154913
@pytest.mark.parametrize("use_dask", [True, False])

0 commit comments

Comments
 (0)