Skip to content

Re-enable tests xfailed in #3808 and fix new CFTimeIndex failures due to upstream changes #3874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 22, 2020
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
4 changes: 2 additions & 2 deletions ci/azure/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ steps:
--upgrade \
matplotlib \
numpy \
pandas \
scipy
python -m pip install \
--no-deps \
Expand All @@ -30,7 +29,8 @@ steps:
git+https://github.com/Unidata/cftime \
git+https://github.com/mapbox/rasterio \
git+https://github.com/hgrecco/pint \
git+https://github.com/pydata/bottleneck
git+https://github.com/pydata/bottleneck \
git+https://github.com/pandas-dev/pandas
condition: eq(variables['UPSTREAM_DEV'], 'true')
displayName: Install upstream dev dependencies

Expand Down
1 change: 1 addition & 0 deletions xarray/coding/cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def __new__(cls, data, name=None):
result = object.__new__(cls)
result._data = np.array(data, dtype="O")
result.name = name
result._cache = {}
return result

def _partial_date_slice(self, resolution, parsed):
Expand Down
17 changes: 2 additions & 15 deletions xarray/tests/test_cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ def test_sel_date_scalar(da, date_type, index):
assert_identical(result, expected)


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
def test_sel_date_distant_date(da, date_type, index):
expected = xr.DataArray(4).assign_coords(time=index[3])
Expand Down Expand Up @@ -513,20 +512,14 @@ def test_sel_date_scalar_backfill(da, date_type, index, sel_kwargs):
[
{"method": "pad", "tolerance": timedelta(days=20)},
{"method": "backfill", "tolerance": timedelta(days=20)},
pytest.param(
{"method": "nearest", "tolerance": timedelta(days=20)},
marks=pytest.mark.xfail(
reason="https://github.com/pydata/xarray/issues/3751"
),
),
{"method": "nearest", "tolerance": timedelta(days=20)},
],
)
def test_sel_date_scalar_tolerance_raises(da, date_type, sel_kwargs):
with pytest.raises(KeyError):
da.sel(time=date_type(1, 5, 1), **sel_kwargs)


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
@pytest.mark.parametrize(
"sel_kwargs",
Expand Down Expand Up @@ -574,12 +567,7 @@ def test_sel_date_list_backfill(da, date_type, index, sel_kwargs):
[
{"method": "pad", "tolerance": timedelta(days=20)},
{"method": "backfill", "tolerance": timedelta(days=20)},
pytest.param(
{"method": "nearest", "tolerance": timedelta(days=20)},
marks=pytest.mark.xfail(
reason="https://github.com/pydata/xarray/issues/3751"
),
),
{"method": "nearest", "tolerance": timedelta(days=20)},
],
)
def test_sel_date_list_tolerance_raises(da, date_type, sel_kwargs):
Expand Down Expand Up @@ -614,7 +602,6 @@ def range_args(date_type):
]


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
def test_indexing_in_series_getitem(series, index, scalar_args, range_args):
for arg in scalar_args:
Expand Down
4 changes: 0 additions & 4 deletions xarray/tests/test_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ def test_datetime_single_string():
assert_allclose(actual.drop_vars("time"), expected)


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
@requires_scipy
def test_cftime():
Expand All @@ -613,7 +612,6 @@ def test_cftime_type_error():
da.interp(time=times_new)


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
@requires_scipy
def test_cftime_list_of_strings():
Expand All @@ -635,7 +633,6 @@ def test_cftime_list_of_strings():
assert_allclose(actual, expected)


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
@requires_scipy
def test_cftime_single_string():
Expand Down Expand Up @@ -697,7 +694,6 @@ def test_datetime_interp_noerror():
a.interp(x=xi, time=xi.time) # should not raise an error


@pytest.mark.xfail(reason="https://github.com/pydata/xarray/issues/3751")
@requires_cftime
def test_3641():
times = xr.cftime_range("0001", periods=3, freq="500Y")
Expand Down