Skip to content

Commit

Permalink
privatize
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Aug 2, 2023
1 parent a45e349 commit 2966521
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions pandas/tests/extension/base/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BaseOpsUtil(BaseExtensionTests):
frame_scalar_exc: type[Exception] | None = TypeError
series_array_exc: type[Exception] | None = TypeError

def get_expected_exception(
def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
# Find the Exception, if any we expect to raise calling
Expand All @@ -35,7 +35,7 @@ def get_op_from_name(self, op_name: str):
return tm.get_op_from_name(op_name)

def check_opname(self, ser: pd.Series, op_name: str, other):
exc = self.get_expected_exception(op_name, ser, other)
exc = self._get_expected_exception(op_name, ser, other)
op = self.get_op_from_name(op_name)

self._check_op(ser, op, other, op_name, exc)
Expand Down Expand Up @@ -67,9 +67,9 @@ def _check_op(
def _check_divmod_op(self, ser: pd.Series, op, other, exc=Exception):
# divmod has multiple return values, so check separately
if op is divmod:
exc = self.get_expected_exception("divmod", ser, other)
exc = self._get_expected_exception("divmod", ser, other)
else:
exc = self.get_expected_exception("rdivmod", ser, other)
exc = self._get_expected_exception("rdivmod", ser, other)
if exc is None:
result_div, result_mod = op(ser, other)
if op is divmod:
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 @@ -331,7 +331,7 @@ class TestArithmeticOps(base.BaseArithmeticOpsTests):
frame_scalar_exc = None
series_array_exc = None

def get_expected_exception(
def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
return None
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ def _is_temporal_supported(self, opname, pa_dtype):
and pa.types.is_temporal(pa_dtype)
)

def get_expected_exception(
def _get_expected_exception(
self, op_name: str, obj, other
) -> type[Exception] | None:
if op_name == "divmod" or op_name == "rdivmod":
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/test_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class TestMissing(base.BaseMissingTests):
class TestArithmeticOps(base.BaseArithmeticOpsTests):
implements = {"__sub__", "__rsub__"}

def get_expected_exception(self, op_name, obj, other):
def _get_expected_exception(self, op_name, obj, other):
if op_name.strip("_").lstrip("r") in ["pow", "truediv", "floordiv"]:
# match behavior with non-masked bool dtype
return NotImplementedError
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/extension/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ class TestInterface(BaseDatetimeTests, base.BaseInterfaceTests):
class TestArithmeticOps(BaseDatetimeTests, base.BaseArithmeticOpsTests):
implements = {"__sub__", "__rsub__"}

def get_expected_exception(self, op_name, obj, other):
def _get_expected_exception(self, op_name, obj, other):
if op_name in self.implements:
return None
return super().get_expected_exception(op_name, obj, other)
return super()._get_expected_exception(op_name, obj, other)

def test_add_series_with_extension_array(self, data):
# Datetime + Datetime not implemented
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/extension/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ class TestInterface(BasePeriodTests, base.BaseInterfaceTests):
class TestArithmeticOps(BasePeriodTests, base.BaseArithmeticOpsTests):
implements = {"__sub__", "__rsub__"}

def get_expected_exception(self, op_name, obj, other):
def _get_expected_exception(self, op_name, obj, other):
if op_name in self.implements:
return None
return super().get_expected_exception(op_name, obj, other)
return super()._get_expected_exception(op_name, obj, other)

def _check_divmod_op(self, s, op, other, exc=NotImplementedError):
super()._check_divmod_op(s, op, other, exc=TypeError)
Expand Down

0 comments on commit 2966521

Please sign in to comment.