8000 String dtype: avoid surfacing pyarrow exception in binary operations by jorisvandenbossche · Pull Request #59610 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

String dtype: avoid surfacing pyarrow exception in binary operations #59610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter 8000

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
Prev Previous commit
Next Next commit
try fix type annotations
  • Loading branch information
jorisvandenbossche committed Aug 27, 2024
commit 649dad1e8ac7583abfb63202b21acb070d756d97
2 changes: 1 addition & 1 deletion pandas/tests/extension/base/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BaseOpsUtil:

def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
) -> type[Exception] | tuple[type[Exception]] | None:
# Find the Exception, if any we expect to raise calling
# obj.__op_name__(other)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/decimal/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def data_for_grouping():
class TestDecimalArray(base.ExtensionTests):
def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
) -> type[Exception] | tuple[type[Exception]] | None:
return None

def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
Expand Down
9 changes: 2 additions & 7 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,6 @@ def test_value_counts_returns_pyarrow_int64(self, data):

_combine_le_expected_dtype = "bool[pyarrow]"

divmod_exc = NotImplementedError

def get_op_from_name(self, op_name):
short_opname = op_name.strip("_")
if short_opname == "rtruediv":
Expand Down Expand Up @@ -944,7 +942,7 @@ def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | tuple[type[Exception], ...] | None:
if op_name in ("__divmod__", "__rdivmod__"):
return (self.divmod_exc, TypeError)
return (NotImplementedError, TypeError)

dtype = tm.get_dtype(obj)
# error: Item "dtype[Any]" of "dtype[Any] | ExtensionDtype" has no
Expand All @@ -968,10 +966,7 @@ def _get_expected_exception(
or pa.types.is_integer(pa_dtype)
or pa.types.is_decimal(pa_dtype)
):
# TODO: in many of these cases, e.g. non-duration temporal,
# these will *never* be allowed. Would it make more sense to
# re-raise as TypeError, more consistent with non-pyarrow cases?
exc = (pa.ArrowNotImplementedError, TypeError)
exc = TypeError
else:
exc = None
return exc
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_fillna_no_op_returns_copy(self, data):

def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
) -> type[Exception] | tuple[type[Exception]] | None:
if op_name in [
"__mod__",
"__rmod__",
Expand Down
Loading
0