Skip to content

Commit c519389

Browse files
authored
TST: remove test_error (#39386)
1 parent 779592d commit c519389

11 files changed

+26
-40
lines changed

pandas/tests/extension/base/ops.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,6 @@ def test_add_series_with_extension_array(self, data):
111111
expected = pd.Series(data + data)
112112
self.assert_series_equal(result, expected)
113113

114-
def test_error(self, data, all_arithmetic_operators):
115-
# invalid ops
116-
op_name = all_arithmetic_operators
117-
with pytest.raises(AttributeError):
118-
getattr(data, op_name)
119-
120114
@pytest.mark.parametrize("box", [pd.Series, pd.DataFrame])
121115
def test_direct_arith_with_ndframe_returns_not_implemented(self, data, box):
122116
# EAs should return NotImplemented for ops with Series/DataFrame

pandas/tests/extension/decimal/test_decimal.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,6 @@ def _check_divmod_op(self, s, op, other, exc=NotImplementedError):
313313
# We implement divmod
314314
super()._check_divmod_op(s, op, other, exc=None)
315315

316-
def test_error(self):
317-
pass
318-
319316

320317
class TestComparisonOps(BaseDecimal, base.BaseComparisonOpsTests):
321318
def check_opname(self, s, op_name, other, exc=None):

pandas/tests/extension/json/test_json.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,6 @@ def test_groupby_agg_extension(self, data_for_grouping):
319319

320320

321321
class TestArithmeticOps(BaseJSON, base.BaseArithmeticOpsTests):
322-
def test_error(self, data, all_arithmetic_operators):
323-
pass
324-
325322
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request):
326323
if len(data[0]) != 1:
327324
mark = pytest.mark.xfail(reason="raises in coercing to Series")

pandas/tests/extension/test_boolean.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ def _check_divmod_op(self, s, op, other, exc=None):
143143
# override to not raise an error
144144
super()._check_divmod_op(s, op, other, None)
145145

146-
@pytest.mark.skip(reason="BooleanArray does not error on ops")
147-
def test_error(self, data, all_arithmetic_operators):
148-
# other specific errors tested in the boolean array specific tests
149-
pass
150-
151146
def test_arith_frame_with_scalar(self, data, all_arithmetic_operators, request):
152147
# frame & scalar
153148
op_name = all_arithmetic_operators

pandas/tests/extension/test_datetime.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ def test_arith_series_with_array(self, data, all_arithmetic_operators):
158158
# ... but not the rest.
159159
super().test_arith_series_with_scalar(data, all_arithmetic_operators)
160160

161-
def test_error(self, data, all_arithmetic_operators):
162-
pass
163-
164161
def test_divmod_series_array(self):
165162
# GH 23287
166163
# skipping because it is not implemented
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Tests for behavior if an author does *not* implement EA methods.
3+
"""
4+
import numpy as np
5+
import pytest
6+
7+
from pandas.core.arrays import ExtensionArray
8+
9+
10+
class MyEA(ExtensionArray):
11+
def __init__(self, values):
12+
self._values = values
13+
14+
15+
@pytest.fixture
16+
def data():
17+
arr = np.arange(10)
18+
return MyEA(arr)
19+
20+
21+
class TestExtensionArray:
22+
def test_errors(self, data, all_arithmetic_operators):
23+
# invalid ops
24+
op_name = all_arithmetic_operators
25+
with pytest.raises(AttributeError):
26+
getattr(data, op_name)

pandas/tests/extension/test_floating.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ def _check_op(self, s, op, other, op_name, exc=NotImplementedError):
123123
def _check_divmod_op(self, s, op, other, exc=None):
124124
super()._check_divmod_op(s, op, other, None)
125125

126-
@pytest.mark.skip(reason="intNA does not error on ops")
127-
def test_error(self, data, all_arithmetic_operators):
128-
# other specific errors tested in the float array specific tests
129-
pass
130-
131126

132127
class TestComparisonOps(base.BaseComparisonOpsTests):
133128
def _check_op(self, s, op, other, op_name, exc=NotImplementedError):

pandas/tests/extension/test_integer.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ def _check_op(self, s, op, other, op_name, exc=NotImplementedError):
153153
def _check_divmod_op(self, s, op, other, exc=None):
154154
super()._check_divmod_op(s, op, other, None)
155155

156-
@pytest.mark.skip(reason="intNA does not error on ops")
157-
def test_error(self, data, all_arithmetic_operators):
158-
# other specific errors tested in the integer array specific tests
159-
pass
160-
161156

162157
class TestComparisonOps(base.BaseComparisonOpsTests):
163158
def _check_op(self, s, op, other, op_name, exc=NotImplementedError):

pandas/tests/extension/test_numpy.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ def test_divmod_series_array(self, data):
283283
ser = pd.Series(data)
284284
self._check_divmod_op(ser, divmod, data, exc=None)
285285

286-
@pytest.mark.skip("We implement ops")
287-
def test_error(self, data, all_arithmetic_operators):
288-
pass
289-
290286
@skip_nested
291287
def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
292288
super().test_arith_series_with_scalar(data, all_arithmetic_operators)

pandas/tests/extension/test_period.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ def test_add_series_with_extension_array(self, data):
138138
with pytest.raises(TypeError, match=msg):
139139
s + data
140140

141-
def test_error(self):
142-
pass
143-
144141
@pytest.mark.parametrize("box", [pd.Series, pd.DataFrame])
145142
def test_direct_arith_with_ndframe_returns_not_implemented(self, data, box):
146143
# Override to use __sub__ instead of __add__

pandas/tests/extension/test_sparse.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ def _skip_if_different_combine(self, data):
393393
# general, so we can't make the expected. This is tested elsewhere
394394
raise pytest.skip("Incorrected expected from Series.combine")
395395

396-
def test_error(self, data, all_arithmetic_operators):
397-
pass
398-
399396
def test_arith_series_with_scalar(self, data, all_arithmetic_operators):
400397
self._skip_if_different_combine(data)
401398
super().test_arith_series_with_scalar(data, all_arithmetic_operators)

0 commit comments

Comments
 (0)