Skip to content

Commit 08efb14

Browse files
Backport PR #71456 on branch 3.1.x (TST: Fix test_reduce_array until reduction methods are implemented for the base class) (#71460)
Co-authored-by: Julian Harbeck <[email protected]>
1 parent ee8dcb7 commit 08efb14

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

‎pandas/tests/extension/base/reduce.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,14 @@ def test_reduce_array(self, request, data, all_reductions, skipna: bool):
181181
getattr(ser.array, op_name)(**kwargs)
182182
return
183183

184-
res_op = getattr(ser.array, op_name)
184+
# GH 68959 Catch until dedicated methods in base class
185+
try:
186+
res_op = getattr(ser.array, op_name)
187+
except AttributeError as e:
188+
pytest.skip(
189+
"In a future version of pandas reductions will be implemented through"
190+
f"dedicated functions: {e}"
191+
)
185192
for call_kwargs in variants:
186193
expected = ser.array._reduce(op_name, **call_kwargs)
187194
result = res_op(**call_kwargs)

‎pandas/tests/extension/decimal/test_decimal.py‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,6 @@ def test_reduce_frame(self, data, all_numeric_reductions, skipna, request):
102102

103103
return super().test_reduce_frame(data, all_numeric_reductions, skipna)
104104

105-
@pytest.mark.parametrize("skipna", [True, False])
106-
def test_reduce_array(self, request, data, all_reductions, skipna: bool):
107-
op_name = all_reductions
108-
ser = pd.Series(data)
109-
110-
if op_name != "count":
111-
# https://github.com/pandas-dev/pandas/pull/63512
112-
# DecimalArray does not implement sum et all as attributes.
113-
msg = f"object has no attribute '{op_name}'"
114-
with pytest.raises(AttributeError, match=msg):
115-
getattr(ser.array, op_name)()
116-
else:
117-
return super().test_reduce_array(request, data, all_reductions, skipna)
118-
119105
def test_compare_array(self, data, comparison_op):
120106
ser = pd.Series(data)
121107

0 commit comments

Comments
 (0)