Skip to content

Commit 2426cc5

Browse files
fix expected exception in test_string.py
1 parent 227b42a commit 2426cc5

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

pandas/tests/extension/test_arrow.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,14 +1064,6 @@ def test_arith_series_with_array(self, data, all_arithmetic_operators, request):
10641064
),
10651065
)
10661066
)
1067-
elif all_arithmetic_operators in ("__rmul__", "__mul__") and (
1068-
pa.types.is_binary(pa_dtype) or pa.types.is_string(pa_dtype)
1069-
):
1070-
request.applymarker(
1071-
pytest.mark.xfail(
1072-
raises=TypeError, reason="Can only string multiply by an integer."
1073-
)
1074-
)
10751067

10761068
mark = self._get_arith_xfail_marker(all_arithmetic_operators, pa_dtype)
10771069
if mark is not None:

pandas/tests/extension/test_string.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,14 @@ def test_fillna_no_op_returns_copy(self, data):
166166
def _get_expected_exception(
167167
self, op_name: str, obj, other
168168
) -> type[Exception] | None:
169-
if op_name in ["__divmod__", "__rdivmod__"]:
170-
if (
171-
isinstance(obj, pd.Series)
172-
and cast(StringDtype, tm.get_dtype(obj)).storage == "pyarrow"
173-
):
174-
# TODO: re-raise as TypeError?
175-
return NotImplementedError
176-
elif (
177-
isinstance(other, pd.Series)
178-
and cast(StringDtype, tm.get_dtype(other)).storage == "pyarrow"
179-
):
180-
# TODO: re-raise as TypeError?
181-
return NotImplementedError
182-
return TypeError
183-
elif op_name in ["__mod__", "__rmod__", "__pow__", "__rpow__"]:
184-
if cast(StringDtype, tm.get_dtype(obj)).storage == "pyarrow":
185-
return NotImplementedError
169+
if op_name in [
170+
"__mod__",
171+
"__rmod__",
172+
"__divmod__",
173+
"__rdivmod__",
174+
"__pow__",
175+
"__rpow__",
176+
]:
186177
return TypeError
187178
elif op_name in ["__mul__", "__rmul__"]:
188179
# Can only multiply strings by integers
@@ -195,11 +186,6 @@ def _get_expected_exception(
195186
"__sub__",
196187
"__rsub__",
197188
]:
198-
if cast(StringDtype, tm.get_dtype(obj)).storage == "pyarrow":
199-
import pyarrow as pa
200-
201-
# TODO: better to re-raise as TypeError?
202-
return pa.ArrowNotImplementedError
203189
return TypeError
204190

205191
return None

0 commit comments

Comments
 (0)