Skip to content

Commit 0aea210

Browse files
committed
pandas-dev/pandas#54252 np.longlong can be tested on non-linux platforms
1 parent ad8cae5 commit 0aea210

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

tests/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
nullcontext,
66
suppress,
77
)
8-
import os
9-
import platform
8+
import sys
109
from typing import (
1110
TYPE_CHECKING,
1211
Final,
@@ -94,7 +93,8 @@
9493
np_ndarray_td: TypeAlias = npt.NDArray[np.timedelta64]
9594

9695
TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING
97-
WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower()
96+
LINUX = sys.platform == "linux"
97+
WINDOWS = sys.platform in {"win32", "cygwin"}
9898
PD_LTE_23 = Version(pd.__version__) < Version("2.3.999")
9999
NUMPY20 = np.lib.NumpyVersion(np.__version__) >= "2.0.0"
100100

tests/series/test_series.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from pandas.core.dtypes.dtypes import CategoricalDtype # noqa F401
5555

5656
from tests import (
57+
LINUX,
5758
PD_LTE_23,
5859
TYPE_CHECKING_INVALID_USAGE,
5960
WINDOWS,
@@ -2624,13 +2625,14 @@ def test_astype_bool(cast_arg: BooleanDtypeArg, target_type: type) -> None:
26242625
def test_astype_int(cast_arg: IntDtypeArg, target_type: type) -> None:
26252626
s = pd.Series([1, 2, 3])
26262627

2627-
if cast_arg in (np.longlong, "longlong", "q"):
2628-
pytest.skip(
2629-
"longlong is bugged, for details, see"
2630-
"https://github.com/pandas-dev/pandas/issues/54252"
2631-
)
2632-
2633-
check(s.astype(cast_arg), pd.Series, target_type)
2628+
s_astype = s.astype(cast_arg)
2629+
if LINUX and cast_arg in (np.longlong, "longlong", "q"):
2630+
# TODO: pandas-dev/pandas#54252 longlong is bugged in Linux
2631+
msg = rf"Expected type '{type(cast_arg)}' but got '{type(s_astype.iloc[0])}'"
2632+
with pytest.raises(RuntimeError, match=msg):
2633+
check(s_astype, pd.Series, target_type)
2634+
else:
2635+
check(s_astype, pd.Series, target_type)
26342636

26352637
if TYPE_CHECKING:
26362638
# python int

0 commit comments

Comments
 (0)