Skip to content

Commit

Permalink
DEPR: BaseNoReduceTests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Aug 21, 2023
1 parent 14a6c9a commit 132c299
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
48 changes: 42 additions & 6 deletions pandas/tests/extension/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ class TestMyDtype(BaseDtypeTests):
BaseUnaryOpsTests,
)
from pandas.tests.extension.base.printing import BasePrintingTests
from pandas.tests.extension.base.reduce import ( # noqa: F401
BaseBooleanReduceTests,
BaseNoReduceTests,
BaseNumericReduceTests,
BaseReduceTests,
)
from pandas.tests.extension.base.reduce import BaseReduceTests
from pandas.tests.extension.base.reshaping import BaseReshapingTests
from pandas.tests.extension.base.setitem import BaseSetitemTests

Expand Down Expand Up @@ -92,3 +87,44 @@ class ExtensionTests(
BaseSetitemTests,
):
pass


def __getattr__(name: str):
import warnings

if name == "BaseNoReduceTests":
warnings.warn(
"BaseNoReduceTests is deprecated and will be removed in a "
"future version. Use BaseReduceTests and override "
"`_supports_reduction` instead.",
FutureWarning,
)
from pandas.tests.extension.base.reduce import BaseNoReduceTests

return BaseNoReduceTests

elif name == "BaseNumericReduceTests":
warnings.warn(
"BaseNumericReduceTests is deprecated and will be removed in a "
"future version. Use BaseReduceTests and override "
"`_supports_reduction` instead.",
FutureWarning,
)
from pandas.tests.extension.base.reduce import BaseNumericReduceTests

return BaseNumericReduceTests

elif name == "BaseBooleanReduceTests":
warnings.warn(
"BaseBooleanReduceTests is deprecated and will be removed in a "
"future version. Use BaseReduceTests and override "
"`_supports_reduction` instead.",
FutureWarning,
)
from pandas.tests.extension.base.reduce import BaseBooleanReduceTests

return BaseBooleanReduceTests

raise AttributeError(
f"module 'pandas.tests.extension.base' has no attribute '{name}'"
)
3 changes: 2 additions & 1 deletion pandas/tests/extension/base/reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def test_reduce_frame(self, data, all_numeric_reductions, skipna):
self.check_reduce_frame(ser, op_name, skipna)


# TODO: deprecate BaseNoReduceTests, BaseNumericReduceTests, BaseBooleanReduceTests
# TODO(3.0): remove BaseNoReduceTests, BaseNumericReduceTests,
# BaseBooleanReduceTests
class BaseNoReduceTests(BaseReduceTests):
"""we don't define any reductions"""

Expand Down

0 comments on commit 132c299

Please sign in to comment.