Skip to content

Commit

Permalink
suppress base & loffset deprecation warnings (pydata#8756)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause authored Feb 15, 2024
1 parent a91d268 commit 5d93331
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xarray/tests/test_cftimeindex_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def da(index) -> xr.DataArray:
)


@pytest.mark.filterwarnings("ignore:.*the `(base|loffset)` parameter to resample")
@pytest.mark.parametrize("freqs", FREQS, ids=lambda x: "{}->{}".format(*x))
@pytest.mark.parametrize("closed", [None, "left", "right"])
@pytest.mark.parametrize("label", [None, "left", "right"])
Expand Down Expand Up @@ -180,6 +181,7 @@ def test_closed_label_defaults(freq, expected) -> None:


@pytest.mark.filterwarnings("ignore:Converting a CFTimeIndex")
@pytest.mark.filterwarnings("ignore:.*the `(base|loffset)` parameter to resample")
@pytest.mark.parametrize(
"calendar", ["gregorian", "noleap", "all_leap", "360_day", "julian"]
)
Expand Down Expand Up @@ -212,6 +214,7 @@ class DateRangeKwargs(TypedDict):
freq: str


@pytest.mark.filterwarnings("ignore:.*the `(base|loffset)` parameter to resample")
@pytest.mark.parametrize("closed", ["left", "right"])
@pytest.mark.parametrize(
"origin",
Expand All @@ -236,6 +239,7 @@ def test_origin(closed, origin) -> None:
)


@pytest.mark.filterwarnings("ignore:.*the `(base|loffset)` parameter to resample")
def test_base_and_offset_error():
cftime_index = xr.cftime_range("2000", periods=5)
da_cftime = da(cftime_index)
Expand Down Expand Up @@ -279,6 +283,7 @@ def test_resample_loffset_cftimeindex(loffset) -> None:
xr.testing.assert_identical(result, expected)


@pytest.mark.filterwarnings("ignore:.*the `(base|loffset)` parameter to resample")
def test_resample_invalid_loffset_cftimeindex() -> None:
times = xr.cftime_range("2000-01-01", freq="6h", periods=10)
da = xr.DataArray(np.arange(10), [("time", times)])
Expand Down

0 comments on commit 5d93331

Please sign in to comment.