Skip to content

Commit 649dad1

Browse files
try fix type annotations
1 parent 34a970a commit 649dad1

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

pandas/tests/extension/base/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class BaseOpsUtil:
2424

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

pandas/tests/extension/decimal/test_decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def data_for_grouping():
6868
class TestDecimalArray(base.ExtensionTests):
6969
def _get_expected_exception(
7070
self, op_name: str, obj, other
71-
) -> type[Exception] | None:
71+
) -> type[Exception] | tuple[type[Exception]] | None:
7272
return None
7373

7474
def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:

pandas/tests/extension/test_arrow.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,6 @@ def test_value_counts_returns_pyarrow_int64(self, data):
807807

808808
_combine_le_expected_dtype = "bool[pyarrow]"
809809

810-
divmod_exc = NotImplementedError
811-
812810
def get_op_from_name(self, op_name):
813811
short_opname = op_name.strip("_")
814812
if short_opname == "rtruediv":
@@ -944,7 +942,7 @@ def _get_expected_exception(
944942
self, op_name: str, obj, other
945943
) -> type[Exception] | tuple[type[Exception], ...] | None:
946944
if op_name in ("__divmod__", "__rdivmod__"):
947-
return (self.divmod_exc, TypeError)
945+
return (NotImplementedError, TypeError)
948946

949947
dtype = tm.get_dtype(obj)
950948
# error: Item "dtype[Any]" of "dtype[Any] | ExtensionDtype" has no
@@ -968,10 +966,7 @@ def _get_expected_exception(
968966
or pa.types.is_integer(pa_dtype)
969967
or pa.types.is_decimal(pa_dtype)
970968
):
971-
# TODO: in many of these cases, e.g. non-duration temporal,
972-
# these will *never* be allowed. Would it make more sense to
973-
# re-raise as TypeError, more consistent with non-pyarrow cases?
974-
exc = (pa.ArrowNotImplementedError, TypeError)
969+
exc = TypeError
975970
else:
976971
exc = None
977972
return exc

pandas/tests/extension/test_string.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def test_fillna_no_op_returns_copy(self, data):
165165

166166
def _get_expected_exception(
167167
self, op_name: str, obj, other
168-
) -> type[Exception] | None:
168+
) -> type[Exception] | tuple[type[Exception]] | None:
169169
if op_name in [
170170
"__mod__",
171171
"__rmod__",

0 commit comments

Comments
 (0)