Skip to content

Commit b5454cb

Browse files
committed
fix: mac_arm
1 parent 4ff4056 commit b5454cb

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

tests/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
nullcontext,
66
suppress,
77
)
8-
import os
98
import platform
109
import sys
1110
from typing import (
@@ -464,8 +463,8 @@
464463
np_ndarray_td: TypeAlias = npt.NDArray[np.timedelta64]
465464

466465
TYPE_CHECKING_INVALID_USAGE: Final = TYPE_CHECKING
467-
WINDOWS = os.name == "nt" or "cygwin" in platform.system().lower()
468-
MAC_ARM = sys.platform == "darwin" and platform.processor() == "arm64"
466+
WINDOWS = sys.platform in {"win32", "cygwin"}
467+
MAC_ARM = sys.platform == "darwin" and platform.processor() == "arm"
469468
PD_LTE_23 = Version(pd.__version__) < Version("2.3.999")
470469
NUMPY20 = np.lib.NumpyVersion(np.__version__) >= "2.0.0"
471470

@@ -671,5 +670,5 @@ def pytest_warns_bounded(
671670
return suppress(upper_exception)
672671

673672

674-
def skip_platform(dtype: type | str | ExtensionDtype) -> bool:
673+
def is_dtype_invalid_for_platform(dtype: type | str | ExtensionDtype) -> bool:
675674
return (WINDOWS or MAC_ARM) and dtype in {"f16", "float128"}

tests/arrays/test_floating_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
PANDAS_FLOAT_ARGS,
1111
PandasFloatDtypeArg,
1212
check,
13-
skip_platform,
13+
is_dtype_invalid_for_platform,
1414
)
1515

1616

@@ -32,8 +32,8 @@ def test_constructor() -> None:
3232

3333
@pytest.mark.parametrize(("dtype", "target_dtype"), PANDAS_FLOAT_ARGS.items(), ids=repr)
3434
def test_constructor_dtype(dtype: PandasFloatDtypeArg, target_dtype: type) -> None:
35-
if skip_platform(dtype):
36-
with pytest.raises(TypeError):
35+
if is_dtype_invalid_for_platform(dtype):
36+
with pytest.raises(TypeError, match=rf"data type {dtype!r} not understood"):
3737
assert_type(pd.array([1.0], dtype=dtype), FloatingArray)
3838
else:
3939
check(pd.array([1.0], dtype=dtype), FloatingArray, target_dtype)

tests/indexes/test_index_float.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
TYPE_FLOAT_NOT_NUMPY16_ARGS,
1111
PandasAstypeFloatDtypeArg,
1212
check,
13-
skip_platform,
13+
is_dtype_invalid_for_platform,
1414
)
1515

1616
if TYPE_CHECKING:
@@ -52,8 +52,8 @@ def test_constructor() -> None:
5252
def test_constructor_dtype(
5353
dtype: "FloatNotNumpy16DtypeArg", target_dtype: type
5454
) -> None:
55-
if skip_platform(dtype):
56-
with pytest.raises(TypeError):
55+
if is_dtype_invalid_for_platform(dtype):
56+
with pytest.raises(TypeError, match=rf"data type {dtype!r} not understood"):
5757
assert_type(pd.Index([1.0], dtype=dtype), "pd.Index[float]")
5858
else:
5959
check(pd.Index([1.0], dtype=dtype), pd.Index, target_dtype)
@@ -110,8 +110,8 @@ def test_astype_float(
110110
) -> None:
111111
s = pd.Index([1, 2, 3])
112112

113-
if skip_platform(cast_arg):
114-
with pytest.raises(TypeError):
113+
if is_dtype_invalid_for_platform(cast_arg):
114+
with pytest.raises(TypeError, match=rf"data type {cast_arg!r} not understood"):
115115
assert_type(s.astype(cast_arg), "pd.Index[float]")
116116
else:
117117
check(s.astype(cast_arg), pd.Index, target_type)

tests/series/test_series_float.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
FloatDtypeArg,
1212
PandasAstypeFloatDtypeArg,
1313
check,
14-
skip_platform,
14+
is_dtype_invalid_for_platform,
1515
)
1616

1717

@@ -46,8 +46,8 @@ def test_constructor() -> None:
4646

4747
@pytest.mark.parametrize(("dtype", "target_dtype"), TYPE_FLOAT_ARGS.items())
4848
def test_constructor_dtype(dtype: FloatDtypeArg, target_dtype: type) -> None:
49-
if skip_platform(dtype):
50-
with pytest.raises(TypeError):
49+
if is_dtype_invalid_for_platform(dtype):
50+
with pytest.raises(TypeError, match=rf"data type {dtype!r} not understood"):
5151
assert_type(pd.Series([1.0], dtype=dtype), "pd.Series[float]")
5252
else:
5353
check(pd.Series([1.0], dtype=dtype), pd.Series, target_dtype)
@@ -102,8 +102,8 @@ def test_astype_float(
102102
) -> None:
103103
s = pd.Series([1, 2, 3])
104104

105-
if skip_platform(cast_arg):
106-
with pytest.raises(TypeError):
105+
if is_dtype_invalid_for_platform(cast_arg):
106+
with pytest.raises(TypeError, match=rf"data type {cast_arg!r} not understood"):
107107
assert_type(s.astype(cast_arg), "pd.Series[float]")
108108
else:
109109
check(s.astype(cast_arg), pd.Series, target_type)

0 commit comments

Comments
 (0)