Skip to content

Commit 2194d12

Browse files
authored
DEPR: remove deprecated extension test classes (#58053)
1 parent 2c9c402 commit 2194d12

File tree

3 files changed

+2
-66
lines changed

3 files changed

+2
-66
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Removal of prior version deprecations/changes
212212
- Disallow units other than "s", "ms", "us", "ns" for datetime64 and timedelta64 dtypes in :func:`array` (:issue:`53817`)
213213
- Removed "freq" keyword from :class:`PeriodArray` constructor, use "dtype" instead (:issue:`52462`)
214214
- Removed deprecated "method" and "limit" keywords from :meth:`Series.replace` and :meth:`DataFrame.replace` (:issue:`53492`)
215+
- Removed extension test classes ``BaseNoReduceTests``, ``BaseNumericReduceTests``, ``BaseBooleanReduceTests`` (:issue:`54663`)
215216
- Removed the "closed" and "normalize" keywords in :meth:`DatetimeIndex.__new__` (:issue:`52628`)
216217
- Stopped performing dtype inference with in :meth:`Index.insert` with object-dtype index; this often affects the index/columns that result when setting new entries into an empty :class:`Series` or :class:`DataFrame` (:issue:`51363`)
217218
- Removed the "closed" and "unit" keywords in :meth:`TimedeltaIndex.__new__` (:issue:`52628`, :issue:`55499`)

pandas/tests/extension/base/__init__.py

+1-44
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ class TestMyDtype(BaseDtypeTests):
6464

6565
# One test class that you can inherit as an alternative to inheriting all the
6666
# test classes above.
67-
# Note 1) this excludes Dim2CompatTests and NDArrayBacked2DTests.
68-
# Note 2) this uses BaseReduceTests and and _not_ BaseBooleanReduceTests,
69-
# BaseNoReduceTests, or BaseNumericReduceTests
67+
# Note this excludes Dim2CompatTests and NDArrayBacked2DTests.
7068
class ExtensionTests(
7169
BaseAccumulateTests,
7270
BaseCastingTests,
@@ -89,44 +87,3 @@ class ExtensionTests(
8987
Dim2CompatTests,
9088
):
9189
pass
92-
93-
94-
def __getattr__(name: str):
95-
import warnings
96-
97-
if name == "BaseNoReduceTests":
98-
warnings.warn(
99-
"BaseNoReduceTests is deprecated and will be removed in a "
100-
"future version. Use BaseReduceTests and override "
101-
"`_supports_reduction` instead.",
102-
FutureWarning,
103-
)
104-
from pandas.tests.extension.base.reduce import BaseNoReduceTests
105-
106-
return BaseNoReduceTests
107-
108-
elif name == "BaseNumericReduceTests":
109-
warnings.warn(
110-
"BaseNumericReduceTests is deprecated and will be removed in a "
111-
"future version. Use BaseReduceTests and override "
112-
"`_supports_reduction` instead.",
113-
FutureWarning,
114-
)
115-
from pandas.tests.extension.base.reduce import BaseNumericReduceTests
116-
117-
return BaseNumericReduceTests
118-
119-
elif name == "BaseBooleanReduceTests":
120-
warnings.warn(
121-
"BaseBooleanReduceTests is deprecated and will be removed in a "
122-
"future version. Use BaseReduceTests and override "
123-
"`_supports_reduction` instead.",
124-
FutureWarning,
125-
)
126-
from pandas.tests.extension.base.reduce import BaseBooleanReduceTests
127-
128-
return BaseBooleanReduceTests
129-
130-
raise AttributeError(
131-
f"module 'pandas.tests.extension.base' has no attribute '{name}'"
132-
)

pandas/tests/extension/base/reduce.py

-22
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,3 @@ def test_reduce_frame(self, data, all_numeric_reductions, skipna):
129129
pytest.skip(f"Reduction {op_name} not supported for this dtype")
130130

131131
self.check_reduce_frame(ser, op_name, skipna)
132-
133-
134-
# TODO(3.0): remove BaseNoReduceTests, BaseNumericReduceTests,
135-
# BaseBooleanReduceTests
136-
class BaseNoReduceTests(BaseReduceTests):
137-
"""we don't define any reductions"""
138-
139-
140-
class BaseNumericReduceTests(BaseReduceTests):
141-
# For backward compatibility only, this only runs the numeric reductions
142-
def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
143-
if op_name in ["any", "all"]:
144-
pytest.skip("These are tested in BaseBooleanReduceTests")
145-
return True
146-
147-
148-
class BaseBooleanReduceTests(BaseReduceTests):
149-
# For backward compatibility only, this only runs the numeric reductions
150-
def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:
151-
if op_name not in ["any", "all"]:
152-
pytest.skip("These are tested in BaseNumericReduceTests")
153-
return True

0 commit comments

Comments
 (0)