Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,11 @@ addopts = [

filterwarnings = [
"error:::xarray.*",
"default:No index created:UserWarning:xarray.core.dataset",
"default::UserWarning:xarray.tests.test_coding_times",
"default::UserWarning:xarray.tests.test_computation",
"default::UserWarning:xarray.tests.test_dataset",
"default:Failed to decode variable.*NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays:DeprecationWarning",
"default:The `interpolation` argument to quantile was renamed to `method`:FutureWarning:xarray.*",
"default:invalid value encountered in cast:RuntimeWarning:xarray.conventions",
"default:invalid value encountered in cast:RuntimeWarning:xarray.tests.test_units",
"default:NumPy will stop allowing conversion of:DeprecationWarning",
"default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable",
"default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning",
"default:Duplicate dimension names present:UserWarning:xarray.namedarray.core",
# Zarr 2 V3 implementation
"ignore:Zarr-Python is not in alignment with the final V3 specification",
# TODO: this is raised for vlen-utf8, consolidated metadata, U1 dtype
Expand Down
3 changes: 3 additions & 0 deletions xarray/tests/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3028,6 +3028,9 @@ def test_quantile_method(self, method) -> None:

np.testing.assert_allclose(actual.values, expected)

@pytest.mark.filterwarnings(
"default:The `interpolation` argument to quantile was renamed to `method`:FutureWarning"
)
@pytest.mark.parametrize("method", ["midpoint", "lower"])
def test_quantile_interpolation_deprecated(self, method) -> None:
da = DataArray(self.va)
Expand Down
11 changes: 7 additions & 4 deletions xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6161,17 +6161,20 @@ def test_quantile_method(self, method) -> None:
assert_identical(result.var2, ds.var2.quantile(q, method=method))
assert_identical(result.var3, ds.var3.quantile(q, method=method))

@pytest.mark.filterwarnings(
"default:The `interpolation` argument to quantile was renamed to `method`:FutureWarning"
)
@pytest.mark.parametrize("method", ["midpoint", "lower"])
def test_quantile_interpolation_deprecated(self, method) -> None:
ds = create_test_data(seed=123)
q = [0.25, 0.5, 0.75]

with warnings.catch_warnings(record=True) as w:
with pytest.warns(
FutureWarning,
match="`interpolation` argument to quantile was renamed to `method`",
):
ds.quantile(q, interpolation=method)

# ensure the warning is only raised once
assert len(w) == 1

with warnings.catch_warnings(record=True):
with pytest.raises(TypeError, match="interpolation and method keywords"):
ds.quantile(q, method=method, interpolation=method)
Expand Down
3 changes: 3 additions & 0 deletions xarray/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ def test_ds_groupby_quantile() -> None:
assert_identical(expected, actual)


@pytest.mark.filterwarnings(
"default:The `interpolation` argument to quantile was renamed to `method`:FutureWarning"
)
@pytest.mark.parametrize("as_dataset", [False, True])
def test_groupby_quantile_interpolation_deprecated(as_dataset: bool) -> None:
array = xr.DataArray(data=[1, 2, 3, 4], coords={"x": [1, 1, 2, 2]}, dims="x")
Expand Down
3 changes: 3 additions & 0 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,9 @@ def test_quantile_method(self, method, use_dask) -> None:

np.testing.assert_allclose(actual.values, expected)

@pytest.mark.filterwarnings(
"default:The `interpolation` argument to quantile was renamed to `method`:FutureWarning"
)
@pytest.mark.parametrize("method", ["midpoint", "lower"])
def test_quantile_interpolation_deprecation(self, method) -> None:
v = Variable(["x", "y"], self.d)
Expand Down
Loading