Skip to content

Commit c7a1ed2

Browse files
author
MarcoGorelli
committed
use is_numpy_dev
1 parent 3b105ff commit c7a1ed2

File tree

4 files changed

+9
-26
lines changed

4 files changed

+9
-26
lines changed

pandas/tests/dtypes/test_missing.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
from decimal import Decimal
44

55
import numpy as np
6-
from pkg_resources import parse_version
76
import pytest
87

98
from pandas._config import config as cf
109

1110
from pandas._libs import missing as libmissing
1211
from pandas._libs.tslibs import iNaT
12+
from pandas.compat import is_numpy_dev
1313

1414
from pandas.core.dtypes.common import (
1515
is_float,
@@ -461,13 +461,7 @@ def test_array_equivalent_series(val):
461461
cm = (
462462
# stacklevel is chosen to make sense when called from .equals
463463
tm.assert_produces_warning(FutureWarning, match=msg, check_stacklevel=False)
464-
if (
465-
isinstance(val, str)
466-
and not (
467-
parse_version(np.__version__) > parse_version("1.24")
468-
and "dev" in np.__version__
469-
)
470-
)
464+
if isinstance(val, str) and not is_numpy_dev
471465
else nullcontext()
472466
)
473467
with cm:

pandas/tests/frame/methods/test_compare.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import numpy as np
2-
from pkg_resources import parse_version
32
import pytest
43

4+
from pandas.compat import is_numpy_dev
5+
56
import pandas as pd
67
import pandas._testing as tm
78

@@ -258,11 +259,7 @@ def test_compare_ea_and_np_dtype(val1, val2):
258259
("b", "other"): np.nan,
259260
}
260261
)
261-
if (
262-
val1 is pd.NA
263-
and parse_version(np.__version__) > parse_version("1.24.0")
264-
and "dev" in np.__version__
265-
):
262+
if val1 is pd.NA and is_numpy_dev:
266263
# can't compare with numpy array if it contains pd.NA
267264
with pytest.raises(TypeError, match="boolean value of NA is ambiguous"):
268265
result = df1.compare(df2, keep_shape=True)

pandas/tests/indexes/object/test_indexing.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from decimal import Decimal
22

33
import numpy as np
4-
from pkg_resources import parse_version
54
import pytest
65

76
from pandas._libs.missing import is_matching_na
7+
from pandas.compat import is_numpy_dev
88

99
import pandas as pd
1010
from pandas import Index
@@ -93,11 +93,7 @@ def test_get_indexer_non_unique_nas(self, nulls_fixture):
9393
tm.assert_numpy_array_equal(indexer, expected_indexer)
9494
tm.assert_numpy_array_equal(missing, expected_missing)
9595

96-
@pytest.mark.skipif(
97-
parse_version(np.__version__) > parse_version("1.24.0")
98-
and "dev" in np.__version__,
99-
reason="GH50124",
100-
)
96+
@pytest.mark.skipif(is_numpy_dev, reason="GH50124")
10197
@pytest.mark.filterwarnings("ignore:elementwise comp:DeprecationWarning")
10298
def test_get_indexer_non_unique_np_nats(self, np_nat_fixture, np_nat_fixture2):
10399
expected_missing = np.array([], dtype=np.intp)

pandas/tests/series/methods/test_equals.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import copy
33

44
import numpy as np
5-
from pkg_resources import parse_version
65
import pytest
76

87
from pandas._libs.missing import is_matching_na
8+
from pandas.compat import is_numpy_dev
99

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

@@ -51,11 +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)
55-
and not (
56-
parse_version(np.__version__) > parse_version("1.24.0")
57-
and "dev" in np.__version__
58-
)
54+
if isinstance(val, str) and not is_numpy_dev
5955
else nullcontext()
6056
)
6157
with cm:

0 commit comments

Comments
 (0)