Skip to content

Commit 058b6d8

Browse files
committed
Add test for rdivmod on EA array (GH23287)
1 parent e28ae70 commit 058b6d8

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
@@ -91,10 +92,18 @@ def test_divmod(self, data):
9192
self._check_divmod_op(s, divmod, 1, exc=self.divmod_exc)
9293
self._check_divmod_op(1, ops.rdivmod, s, exc=self.divmod_exc)
9394

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

100+
#pytest.set_trace()
101+
other = ones * 2
102+
self._check_divmod_op(other, ops.rdivmod, s)
103+
104+
other = pd.Series(other)
105+
self._check_divmod_op(other, ops.rdivmod, s)
106+
98107
def test_add_series_with_extension_array(self, data):
99108
s = pd.Series(data)
100109
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
@@ -290,6 +290,9 @@ def test_add_series_with_extension_array(self, data):
290290
with pytest.raises(TypeError, match="unsupported"):
291291
ser + data
292292

293+
def test_divmod_series_array(self):
294+
pass
295+
293296
def _check_divmod_op(self, s, op, other, exc=NotImplementedError):
294297
return super(TestArithmeticOps, self)._check_divmod_op(
295298
s, op, other, exc=TypeError

pandas/tests/extension/test_categorical.py

+3
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ def test_add_series_with_extension_array(self, data):
214214
with pytest.raises(TypeError, match="cannot perform"):
215215
ser + data
216216

217+
def test_divmod_series_array(self):
218+
pass
219+
217220
def _check_divmod_op(self, s, op, other, exc=NotImplementedError):
218221
return super(TestArithmeticOps, self)._check_divmod_op(
219222
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
@@ -34,6 +34,11 @@ def data(request):
3434
return res
3535

3636

37+
@pytest.fixture
38+
def ones(request):
39+
return SparseArray(np.ones(100))
40+
41+
3742
@pytest.fixture(params=[0, np.nan])
3843
def data_missing(request):
3944
"""Length 2 array with [NA, Valid]"""

0 commit comments

Comments
 (0)