Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
nullcontext,
suppress,
)
import os
import platform
import sys
from typing import (
TYPE_CHECKING,
Final,
Expand Down Expand Up @@ -94,7 +93,9 @@
np_ndarray_td: TypeAlias = npt.NDArray[np.timedelta64]

TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING
WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower()
LINUX = sys.platform == "linux"
WINDOWS = sys.platform in {"win32", "cygwin"}
MAC = sys.platform == "darwin"
PD_LTE_23 = Version(pd.__version__) < Version("2.3.999")
NUMPY20 = np.lib.NumpyVersion(np.__version__) >= "2.0.0"

Expand Down
17 changes: 10 additions & 7 deletions tests/series/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
from pandas.core.dtypes.dtypes import CategoricalDtype # noqa F401

from tests import (
LINUX,
MAC,
PD_LTE_23,
TYPE_CHECKING_INVALID_USAGE,
WINDOWS,
Expand Down Expand Up @@ -2624,13 +2626,14 @@ def test_astype_bool(cast_arg: BooleanDtypeArg, target_type: type) -> None:
def test_astype_int(cast_arg: IntDtypeArg, target_type: type) -> None:
s = pd.Series([1, 2, 3])

if cast_arg in (np.longlong, "longlong", "q"):
pytest.skip(
"longlong is bugged, for details, see"
"https://github.com/pandas-dev/pandas/issues/54252"
)

check(s.astype(cast_arg), pd.Series, target_type)
s_astype = s.astype(cast_arg)
if (LINUX or MAC) and cast_arg in {np.longlong, "longlong", "q"}:
# TODO: pandas-dev/pandas#54252 longlong is bugged on Linux and Mac
msg = rf"Expected type '{target_type}' but got '{type(s_astype.iloc[0])}'"
with pytest.raises(RuntimeError, match=msg):
check(s_astype, pd.Series, target_type)
else:
check(s_astype, pd.Series, target_type)

if TYPE_CHECKING:
# python int
Expand Down