Skip to content

CI: silence numpy-dev failures #32025

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 3 commits into from
Feb 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions pandas/tests/frame/test_cumulative.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"""

import numpy as np
import pytest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use the _test_decorator version of this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you referring to pandas/util/_test_decorators.py?

we have nothing for np-dev there (just skip_if_np_lt) . also those are skips and don't we want an xfail?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok instead of importing from here (this is not meant for this)
import from pd. where all of the lives (you will to add the import in pandas/init.py

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. we currently have a mixture of imports for _np_version_under1p* and wasn't sure which was the preferred.

from pandas.compat.numpy import _is_numpy_dev

from pandas import DataFrame, Series
import pandas._testing as tm
Expand Down Expand Up @@ -73,6 +76,9 @@ def test_cumprod(self, datetime_frame):
df.cumprod(0)
df.cumprod(1)

@pytest.mark.xfail(
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
)
def test_cummin(self, datetime_frame):
datetime_frame.loc[5:10, 0] = np.nan
datetime_frame.loc[10:15, 1] = np.nan
Expand All @@ -96,6 +102,9 @@ def test_cummin(self, datetime_frame):
cummin_xs = datetime_frame.cummin(axis=1)
assert np.shape(cummin_xs) == np.shape(datetime_frame)

@pytest.mark.xfail(
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
)
def test_cummax(self, datetime_frame):
datetime_frame.loc[5:10, 0] = np.nan
datetime_frame.loc[10:15, 1] = np.nan
Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/groupby/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest

from pandas._libs import groupby
from pandas.compat.numpy import _is_numpy_dev

from pandas.core.dtypes.common import ensure_platform_int, is_timedelta64_dtype

Expand Down Expand Up @@ -329,6 +330,8 @@ def test_transform_transformation_func(transformation_func):
if transformation_func in ["pad", "backfill", "tshift", "corrwith", "cumcount"]:
# These transformation functions are not yet covered in this test
pytest.xfail("See GH 31269 and GH 31270")
elif _is_numpy_dev and transformation_func in ["cummin"]:
pytest.xfail("https://github.com/pandas-dev/pandas/issues/31992")
elif transformation_func == "fillna":
test_op = lambda x: x.transform("fillna", value=0)
mock_op = lambda x: x.fillna(value=0)
Expand Down
24 changes: 18 additions & 6 deletions pandas/tests/scalar/timedelta/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import numpy as np
import pytest

from pandas.compat.numpy import _is_numpy_dev

import pandas as pd
from pandas import NaT, Timedelta, Timestamp, offsets
import pandas._testing as tm
Expand Down Expand Up @@ -377,18 +379,28 @@ def test_td_div_numeric_scalar(self):
assert isinstance(result, Timedelta)
assert result == Timedelta(days=2)

@pytest.mark.parametrize("nan", [np.nan, np.float64("NaN"), float("nan")])
@pytest.mark.parametrize(
"nan",
[
np.nan,
pytest.param(
np.float64("NaN"),
marks=pytest.mark.xfail(
_is_numpy_dev,
reason="https://github.com/pandas-dev/pandas/issues/31992",
),
),
float("nan"),
],
)
def test_td_div_nan(self, nan):
# np.float64('NaN') has a 'dtype' attr, avoid treating as array
td = Timedelta(10, unit="d")
result = td / nan
assert result is NaT

# TODO: Don't leave commented, this is just a temporary fix for
# https://github.com/pandas-dev/pandas/issues/31992

# result = td // nan
# assert result is NaT
result = td // nan
assert result is NaT

# ---------------------------------------------------------------
# Timedelta.__rdiv__
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/series/test_cumulative.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import numpy as np
import pytest

from pandas.compat.numpy import _is_numpy_dev

import pandas as pd
import pandas._testing as tm

Expand Down Expand Up @@ -37,6 +39,9 @@ def test_cumsum(self, datetime_series):
def test_cumprod(self, datetime_series):
_check_accum_op("cumprod", datetime_series)

@pytest.mark.xfail(
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
)
def test_cummin(self, datetime_series):
tm.assert_numpy_array_equal(
datetime_series.cummin().values,
Expand All @@ -49,6 +54,9 @@ def test_cummin(self, datetime_series):

tm.assert_series_equal(result, expected)

@pytest.mark.xfail(
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
)
def test_cummax(self, datetime_series):
tm.assert_numpy_array_equal(
datetime_series.cummax().values,
Expand Down