Skip to content

DEPR: BaseNoReduceTests #54663

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 3 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v2.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Deprecations
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_pickle` except ``path``. (:issue:`54229`)
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_string` except ``buf``. (:issue:`54229`)
- Deprecated not passing a tuple to :class:`DataFrameGroupBy.get_group` or :class:`SeriesGroupBy.get_group` when grouping by a length-1 list-like (:issue:`25971`)

- Deprecated the extension test classes ``BaseNoReduceTests``, ``BaseBooleanReduceTests``, and ``BaseNumericReduceTests``, use ``BaseReduceTests`` instead (:issue:`54663`)
-

.. ---------------------------------------------------------------------------
Expand Down
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