Skip to content

Commit 43d12a2

Browse files
authored
CI: Adjust tests for release of numpy 1.25 (#53715)
1 parent 0bc16da commit 43d12a2

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

pandas/compat/numpy/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
np_version_under1p22 = _nlv < Version("1.22")
1010
np_version_gte1p24 = _nlv >= Version("1.24")
1111
np_version_gte1p24p3 = _nlv >= Version("1.24.3")
12+
np_version_gte1p25 = _nlv >= Version("1.25")
1213
is_numpy_dev = _nlv.dev is not None
1314
_min_numpy_ver = "1.21.6"
1415

pandas/tests/apply/test_frame_apply_relabeling.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pytest
33

4-
from pandas.compat import is_numpy_dev
4+
from pandas.compat.numpy import np_version_gte1p25
55

66
import pandas as pd
77
import pandas._testing as tm
@@ -45,7 +45,7 @@ def test_agg_relabel_multi_columns_multi_methods():
4545
tm.assert_frame_equal(result, expected)
4646

4747

48-
@pytest.mark.xfail(is_numpy_dev, reason="name of min now equals name of np.min")
48+
@pytest.mark.xfail(np_version_gte1p25, reason="name of min now equals name of np.min")
4949
def test_agg_relabel_partial_functions():
5050
# GH 26513, test on partial, functools or more complex cases
5151
df = pd.DataFrame({"A": [1, 2, 1, 2], "B": [1, 2, 3, 4], "C": [3, 4, 5, 6]})

pandas/tests/dtypes/test_missing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +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
12+
from pandas.compat.numpy import np_version_gte1p25
1313

1414
from pandas.core.dtypes.common import (
1515
is_float,
@@ -468,7 +468,7 @@ def test_array_equivalent_series(val):
468468
cm = (
469469
# stacklevel is chosen to make sense when called from .equals
470470
tm.assert_produces_warning(FutureWarning, match=msg, check_stacklevel=False)
471-
if isinstance(val, str) and not is_numpy_dev
471+
if isinstance(val, str) and not np_version_gte1p25
472472
else nullcontext()
473473
)
474474
with cm:

pandas/tests/frame/methods/test_compare.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pytest
33

4-
from pandas.compat import is_numpy_dev
4+
from pandas.compat.numpy import np_version_gte1p25
55

66
import pandas as pd
77
import pandas._testing as tm
@@ -269,7 +269,7 @@ def test_compare_ea_and_np_dtype(val1, val2):
269269
# GH#18463 TODO: is this really the desired behavior?
270270
expected.loc[1, ("a", "self")] = np.nan
271271

272-
if val1 is pd.NA and is_numpy_dev:
272+
if val1 is pd.NA and np_version_gte1p25:
273273
# can't compare with numpy array if it contains pd.NA
274274
with pytest.raises(TypeError, match="boolean value of NA is ambiguous"):
275275
result = df1.compare(df2, keep_shape=True)

pandas/tests/frame/test_unary.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44
import pytest
55

6-
from pandas.compat import is_numpy_dev
6+
from pandas.compat.numpy import np_version_gte1p25
77

88
import pandas as pd
99
import pandas._testing as tm
@@ -130,7 +130,7 @@ def test_pos_object(self, df):
130130
)
131131
def test_pos_object_raises(self, df):
132132
# GH#21380
133-
if is_numpy_dev:
133+
if np_version_gte1p25:
134134
with pytest.raises(
135135
TypeError, match=r"^bad operand type for unary \+: \'str\'$"
136136
):

pandas/tests/series/methods/test_describe.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pytest
33

4-
from pandas.compat import is_numpy_dev
4+
from pandas.compat.numpy import np_version_gte1p25
55

66
from pandas.core.dtypes.common import (
77
is_complex_dtype,
@@ -166,7 +166,7 @@ def test_numeric_result_dtype(self, any_numeric_dtype):
166166
dtype = "complex128" if is_complex_dtype(any_numeric_dtype) else None
167167

168168
ser = Series([0, 1], dtype=any_numeric_dtype)
169-
if dtype == "complex128" and is_numpy_dev:
169+
if dtype == "complex128" and np_version_gte1p25:
170170
with pytest.raises(
171171
TypeError, match=r"^a must be an array of real numbers$"
172172
):

pandas/tests/series/methods/test_equals.py

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

77
from pandas._libs.missing import is_matching_na
8-
from pandas.compat import is_numpy_dev
8+
from pandas.compat.numpy import np_version_gte1p25
99

1010
from pandas.core.dtypes.common import is_float
1111

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

5252
cm = (
5353
tm.assert_produces_warning(FutureWarning, check_stacklevel=False)
54-
if isinstance(val, str) and not is_numpy_dev
54+
if isinstance(val, str) and not np_version_gte1p25
5555
else nullcontext()
5656
)
5757
with cm:

0 commit comments

Comments
 (0)