Skip to content

Commit 53ece70

Browse files
CI: silence numpy-dev failures (#32025)
1 parent 2aa9cb9 commit 53ece70

File tree

7 files changed

+41
-8
lines changed

7 files changed

+41
-8
lines changed

pandas/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
_np_version_under1p16,
2626
_np_version_under1p17,
2727
_np_version_under1p18,
28+
_is_numpy_dev,
2829
)
2930

3031
try:

pandas/tests/api/test_api.py

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class TestPDApi(Base):
198198
"_np_version_under1p16",
199199
"_np_version_under1p17",
200200
"_np_version_under1p18",
201+
"_is_numpy_dev",
201202
"_testing",
202203
"_tslib",
203204
"_typing",

pandas/tests/frame/test_cumulative.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"""
88

99
import numpy as np
10+
import pytest
1011

11-
from pandas import DataFrame, Series
12+
from pandas import DataFrame, Series, _is_numpy_dev
1213
import pandas._testing as tm
1314

1415

@@ -73,6 +74,9 @@ def test_cumprod(self, datetime_frame):
7374
df.cumprod(0)
7475
df.cumprod(1)
7576

77+
@pytest.mark.xfail(
78+
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
79+
)
7680
def test_cummin(self, datetime_frame):
7781
datetime_frame.loc[5:10, 0] = np.nan
7882
datetime_frame.loc[10:15, 1] = np.nan
@@ -96,6 +100,9 @@ def test_cummin(self, datetime_frame):
96100
cummin_xs = datetime_frame.cummin(axis=1)
97101
assert np.shape(cummin_xs) == np.shape(datetime_frame)
98102

103+
@pytest.mark.xfail(
104+
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
105+
)
99106
def test_cummax(self, datetime_frame):
100107
datetime_frame.loc[5:10, 0] = np.nan
101108
datetime_frame.loc[10:15, 1] = np.nan

pandas/tests/groupby/test_function.py

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
NaT,
1818
Series,
1919
Timestamp,
20+
_is_numpy_dev,
2021
date_range,
2122
isna,
2223
)
@@ -685,6 +686,9 @@ def test_numpy_compat(func):
685686
getattr(g, func)(foo=1)
686687

687688

689+
@pytest.mark.xfail(
690+
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
691+
)
688692
def test_cummin_cummax():
689693
# GH 15048
690694
num_types = [np.int32, np.int64, np.float32, np.float64]

pandas/tests/groupby/test_transform.py

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
MultiIndex,
1616
Series,
1717
Timestamp,
18+
_is_numpy_dev,
1819
concat,
1920
date_range,
2021
)
@@ -329,6 +330,8 @@ def test_transform_transformation_func(transformation_func):
329330
if transformation_func in ["pad", "backfill", "tshift", "corrwith", "cumcount"]:
330331
# These transformation functions are not yet covered in this test
331332
pytest.xfail("See GH 31269 and GH 31270")
333+
elif _is_numpy_dev and transformation_func in ["cummin"]:
334+
pytest.xfail("https://github.com/pandas-dev/pandas/issues/31992")
332335
elif transformation_func == "fillna":
333336
test_op = lambda x: x.transform("fillna", value=0)
334337
mock_op = lambda x: x.fillna(value=0)

pandas/tests/scalar/timedelta/test_arithmetic.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99

1010
import pandas as pd
11-
from pandas import NaT, Timedelta, Timestamp, offsets
11+
from pandas import NaT, Timedelta, Timestamp, _is_numpy_dev, offsets
1212
import pandas._testing as tm
1313
from pandas.core import ops
1414

@@ -377,18 +377,28 @@ def test_td_div_numeric_scalar(self):
377377
assert isinstance(result, Timedelta)
378378
assert result == Timedelta(days=2)
379379

380-
@pytest.mark.parametrize("nan", [np.nan, np.float64("NaN"), float("nan")])
380+
@pytest.mark.parametrize(
381+
"nan",
382+
[
383+
np.nan,
384+
pytest.param(
385+
np.float64("NaN"),
386+
marks=pytest.mark.xfail(
387+
_is_numpy_dev,
388+
reason="https://github.com/pandas-dev/pandas/issues/31992",
389+
),
390+
),
391+
float("nan"),
392+
],
393+
)
381394
def test_td_div_nan(self, nan):
382395
# np.float64('NaN') has a 'dtype' attr, avoid treating as array
383396
td = Timedelta(10, unit="d")
384397
result = td / nan
385398
assert result is NaT
386399

387-
# TODO: Don't leave commented, this is just a temporary fix for
388-
# https://github.com/pandas-dev/pandas/issues/31992
389-
390-
# result = td // nan
391-
# assert result is NaT
400+
result = td // nan
401+
assert result is NaT
392402

393403
# ---------------------------------------------------------------
394404
# Timedelta.__rdiv__

pandas/tests/series/test_cumulative.py

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest
1212

1313
import pandas as pd
14+
from pandas import _is_numpy_dev
1415
import pandas._testing as tm
1516

1617

@@ -37,6 +38,9 @@ def test_cumsum(self, datetime_series):
3738
def test_cumprod(self, datetime_series):
3839
_check_accum_op("cumprod", datetime_series)
3940

41+
@pytest.mark.xfail(
42+
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
43+
)
4044
def test_cummin(self, datetime_series):
4145
tm.assert_numpy_array_equal(
4246
datetime_series.cummin().values,
@@ -49,6 +53,9 @@ def test_cummin(self, datetime_series):
4953

5054
tm.assert_series_equal(result, expected)
5155

56+
@pytest.mark.xfail(
57+
_is_numpy_dev, reason="https://github.com/pandas-dev/pandas/issues/31992"
58+
)
5259
def test_cummax(self, datetime_series):
5360
tm.assert_numpy_array_equal(
5461
datetime_series.cummax().values,

0 commit comments

Comments
 (0)