Skip to content

Commit 08a4e74

Browse files
authored
Backport PR #50129 on branch 1.5.x (CI: fix with new numpy nightly) (#50167)
Backport PR #50129: CI: fix with new numpy nightly
1 parent bfe3af2 commit 08a4e74

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

pandas/tests/dtypes/test_missing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from pandas._libs import missing as libmissing
1111
from pandas._libs.tslibs import iNaT
12+
from pandas.compat import is_numpy_dev
1213

1314
from pandas.core.dtypes.common import (
1415
is_float,
@@ -461,7 +462,7 @@ def test_array_equivalent_series(val):
461462
cm = (
462463
# stacklevel is chosen to make sense when called from .equals
463464
tm.assert_produces_warning(FutureWarning, match=msg, check_stacklevel=False)
464-
if isinstance(val, str)
465+
if isinstance(val, str) and not is_numpy_dev
465466
else nullcontext()
466467
)
467468
with cm:

pandas/tests/indexes/object/test_indexing.py

+7
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ def test_get_indexer_non_unique_np_nats(self, np_nat_fixture, np_nat_fixture2):
128128
tm.assert_numpy_array_equal(missing, expected_missing)
129129
# dt64nat vs td64nat
130130
else:
131+
try:
132+
np_nat_fixture == np_nat_fixture2
133+
except (TypeError, OverflowError):
134+
# Numpy will raise on uncomparable types, like
135+
# np.datetime64('NaT', 'Y') and np.datetime64('NaT', 'ps')
136+
# https://github.com/numpy/numpy/issues/22762
137+
return
131138
index = Index(
132139
np.array(
133140
[

pandas/tests/series/methods/test_equals.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from pandas._libs.missing import is_matching_na
8+
from pandas.compat import is_numpy_dev
89

910
from pandas.core.dtypes.common import is_float
1011

@@ -50,7 +51,7 @@ def test_equals_list_array(val):
5051

5152
cm = (
5253
tm.assert_produces_warning(FutureWarning, check_stacklevel=False)
53-
if isinstance(val, str)
54+
if isinstance(val, str) and not is_numpy_dev
5455
else nullcontext()
5556
)
5657
with cm:

0 commit comments

Comments
 (0)