Skip to content

Commit

Permalink
CI: Fix npdev build (#29860)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and jreback committed Nov 27, 2019
1 parent 3676831 commit 0c0adfb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions pandas/__init__.py
Expand Up @@ -24,6 +24,7 @@
_np_version_under1p15,
_np_version_under1p16,
_np_version_under1p17,
_np_version_under1p18,
)

try:
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/api/test_api.py
Expand Up @@ -189,6 +189,7 @@ class TestPDApi(Base):
"_np_version_under1p15",
"_np_version_under1p16",
"_np_version_under1p17",
"_np_version_under1p18",
"_tslib",
"_typing",
"_version",
Expand Down
14 changes: 10 additions & 4 deletions pandas/tests/indexes/test_numpy_compat.py
Expand Up @@ -6,9 +6,11 @@
Float64Index,
Index,
Int64Index,
PeriodIndex,
TimedeltaIndex,
UInt64Index,
_np_version_under1p17,
_np_version_under1p18,
)
from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
import pandas.util.testing as tm
Expand Down Expand Up @@ -80,18 +82,22 @@ def test_numpy_ufuncs_other(indices, func):
idx = indices
if isinstance(idx, (DatetimeIndex, TimedeltaIndex)):

# ok under numpy >= 1.17
if not _np_version_under1p17 and func in [np.isfinite]:
if not _np_version_under1p18 and func in [np.isfinite, np.isinf, np.isnan]:
# numpy 1.18(dev) changed isinf and isnan to not raise on dt64/tfd64
result = func(idx)
assert isinstance(result, np.ndarray)

elif not _np_version_under1p17 and func in [np.isfinite]:
# ok under numpy >= 1.17
# Results in bool array
result = func(idx)
assert isinstance(result, np.ndarray)
assert not isinstance(result, Index)
else:
# raise TypeError or ValueError (PeriodIndex)
with pytest.raises(Exception):
func(idx)

elif isinstance(idx, DatetimeIndexOpsMixin):
elif isinstance(idx, PeriodIndex):
# raise TypeError or ValueError (PeriodIndex)
with pytest.raises(Exception):
func(idx)
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/reshape/test_concat.py
Expand Up @@ -765,13 +765,15 @@ def test_concat_join_axes_deprecated(self, axis):
)

expected = pd.concat([one, two], axis=1, sort=False).reindex(index=two.index)
result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index])
with tm.assert_produces_warning(FutureWarning):
result = pd.concat([one, two], axis=1, sort=False, join_axes=[two.index])
tm.assert_frame_equal(result, expected)

expected = pd.concat([one, two], axis=0, sort=False).reindex(
columns=two.columns
)
result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns])
with tm.assert_produces_warning(FutureWarning):
result = pd.concat([one, two], axis=0, sort=False, join_axes=[two.columns])
tm.assert_frame_equal(result, expected)


Expand Down

0 comments on commit 0c0adfb

Please sign in to comment.