Skip to content

Commit a2dbea8

Browse files
committed
Add test for rdivmod on EA array (GH23287)
1 parent a7b187a commit a2dbea8

File tree

7 files changed

+34
-1
lines changed

7 files changed

+34
-1
lines changed

pandas/tests/extension/base/ops.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import operator
22

33
import pytest
4+
import numpy as np
45

56
import pandas as pd
67
from pandas.core import ops
@@ -92,10 +93,18 @@ def test_divmod(self, data):
9293
self._check_divmod_op(s, divmod, 1, exc=self.divmod_exc)
9394
self._check_divmod_op(1, ops.rdivmod, s, exc=self.divmod_exc)
9495

95-
def test_divmod_series_array(self, data):
96+
def test_divmod_series_array(self, data, ones):
97+
#pytest.set_trace()
9698
s = pd.Series(data)
9799
self._check_divmod_op(s, divmod, data)
98100

101+
#pytest.set_trace()
102+
other = ones * 2
103+
self._check_divmod_op(other, ops.rdivmod, s)
104+
105+
other = pd.Series(other)
106+
self._check_divmod_op(other, ops.rdivmod, s)
107+
99108
def test_add_series_with_extension_array(self, data):
100109
s = pd.Series(data)
101110
result = s + data

pandas/tests/extension/decimal/test_decimal.py

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def data():
2323
return DecimalArray(make_data())
2424

2525

26+
@pytest.fixture
27+
def ones():
28+
return DecimalArray([decimal.Decimal(1) for _ in range(100)])
29+
30+
2631
@pytest.fixture
2732
def data_missing():
2833
return DecimalArray([decimal.Decimal('NaN'), decimal.Decimal(1)])

pandas/tests/extension/json/test_json.py

+3
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ def test_add_series_with_extension_array(self, data):
275275
with pytest.raises(TypeError, match="unsupported"):
276276
ser + data
277277

278+
def test_divmod_series_array(self):
279+
pass
280+
278281
def _check_divmod_op(self, s, op, other, exc=NotImplementedError):
279282
return super(TestArithmeticOps, self)._check_divmod_op(
280283
s, op, other, exc=TypeError

pandas/tests/extension/test_categorical.py

+3
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ def test_add_series_with_extension_array(self, data):
200200
with pytest.raises(TypeError, match="cannot perform"):
201201
ser + data
202202

203+
def test_divmod_series_array(self):
204+
pass
205+
203206
def _check_divmod_op(self, s, op, other, exc=NotImplementedError):
204207
return super(TestArithmeticOps, self)._check_divmod_op(
205208
s, op, other, exc=TypeError

pandas/tests/extension/test_integer.py

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def data(dtype):
4242
return integer_array(make_data(), dtype=dtype)
4343

4444

45+
@pytest.fixture
46+
def ones(dtype):
47+
return integer_array(np.ones(100), dtype=dtype)
48+
49+
4550
@pytest.fixture
4651
def data_missing(dtype):
4752
return integer_array([np.nan, 1], dtype=dtype)

pandas/tests/extension/test_period.py

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def test_direct_arith_with_series_returns_not_implemented(self, data):
125125
result = data.__sub__(other)
126126
assert result is NotImplemented
127127

128+
def test_divmod_series_array(self):
129+
pass
130+
128131

129132
class TestCasting(BasePeriodTests, base.BaseCastingTests):
130133
pass

pandas/tests/extension/test_sparse.py

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def data(request):
3131
return res
3232

3333

34+
@pytest.fixture
35+
def ones(request):
36+
return SparseArray(np.ones(100))
37+
38+
3439
@pytest.fixture(params=[0, np.nan])
3540
def data_missing(request):
3641
"""Length 2 array with [NA, Valid]"""

0 commit comments

Comments
 (0)