Skip to content

Commit 0c0adfb

Browse files
jbrockmendeljreback
authored andcommitted
CI: Fix npdev build (#29860)
1 parent 3676831 commit 0c0adfb

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

pandas/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
_np_version_under1p15,
2525
_np_version_under1p16,
2626
_np_version_under1p17,
27+
_np_version_under1p18,
2728
)
2829

2930
try:

pandas/tests/api/test_api.py

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ class TestPDApi(Base):
189189
"_np_version_under1p15",
190190
"_np_version_under1p16",
191191
"_np_version_under1p17",
192+
"_np_version_under1p18",
192193
"_tslib",
193194
"_typing",
194195
"_version",

pandas/tests/indexes/test_numpy_compat.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
Float64Index,
77
Index,
88
Int64Index,
9+
PeriodIndex,
910
TimedeltaIndex,
1011
UInt64Index,
1112
_np_version_under1p17,
13+
_np_version_under1p18,
1214
)
1315
from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
1416
import pandas.util.testing as tm
@@ -80,18 +82,22 @@ def test_numpy_ufuncs_other(indices, func):
8082
idx = indices
8183
if isinstance(idx, (DatetimeIndex, TimedeltaIndex)):
8284

83-
# ok under numpy >= 1.17
84-
if not _np_version_under1p17 and func in [np.isfinite]:
85+
if not _np_version_under1p18 and func in [np.isfinite, np.isinf, np.isnan]:
86+
# numpy 1.18(dev) changed isinf and isnan to not raise on dt64/tfd64
87+
result = func(idx)
88+
assert isinstance(result, np.ndarray)
89+
90+
elif not _np_version_under1p17 and func in [np.isfinite]:
91+
# ok under numpy >= 1.17
8592
# Results in bool array
8693
result = func(idx)
8794
assert isinstance(result, np.ndarray)
88-
assert not isinstance(result, Index)
8995
else:
9096
# raise TypeError or ValueError (PeriodIndex)
9197
with pytest.raises(Exception):
9298
func(idx)
9399

94-
elif isinstance(idx, DatetimeIndexOpsMixin):
100+
elif isinstance(idx, PeriodIndex):
95101
# raise TypeError or ValueError (PeriodIndex)
96102
with pytest.raises(Exception):
97103
func(idx)

pandas/tests/reshape/test_concat.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,15 @@ def test_concat_join_axes_deprecated(self, axis):
765765
)
766766

767767
expected = pd.concat([one, two], axis=1, sort=False).reindex(index=two.index)
768-
result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index])
768+
with tm.assert_produces_warning(FutureWarning):
769+
result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index])
769770
tm.assert_frame_equal(result, expected)
770771

771772
expected = pd.concat([one, two], axis=0, sort=False).reindex(
772773
columns=two.columns
773774
)
774-
result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns])
775+
with tm.assert_produces_warning(FutureWarning):
776+
result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns])
775777
tm.assert_frame_equal(result, expected)
776778

777779

0 commit comments

Comments
 (0)