Skip to content

Commit 0671e7d

Browse files
committed
Fixup
1 parent 1b4261f commit 0671e7d

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

pandas/tests/extension/decimal/test_decimal.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from pandas.tests.extension import base
1010

11-
from .array import DecimalDtype, DecimalArray
11+
from .array import DecimalDtype, DecimalArray, to_decimal
1212

1313

1414
def make_data():
@@ -244,6 +244,23 @@ def test_arith_series_with_array(self, data, all_arithmetic_operators):
244244
context.traps[decimal.DivisionByZero] = divbyzerotrap
245245
context.traps[decimal.InvalidOperation] = invalidoptrap
246246

247+
@pytest.mark.parametrize("reverse, expected_div, expected_mod", [
248+
(False, [0, 1, 1, 2], [1, 0, 1, 0]),
249+
(True, [2, 1, 0, 0], [0, 0, 2, 2]),
250+
])
251+
def test_divmod_array(self, reverse, expected_div, expected_mod):
252+
# https://github.com/pandas-dev/pandas/issues/22930
253+
arr = to_decimal([1, 2, 3, 4])
254+
if reverse:
255+
div, mod = divmod(2, arr)
256+
else:
257+
div, mod = divmod(arr, 2)
258+
expected_div = to_decimal(expected_div)
259+
expected_mod = to_decimal(expected_mod)
260+
261+
tm.assert_extension_array_equal(div, expected_div)
262+
tm.assert_extension_array_equal(mod, expected_mod)
263+
247264
def test_divmod(self, data):
248265
s = pd.Series(data, name='name')
249266
a, b = divmod(s, 2)

pandas/tests/extension/test_ops.py

-22
This file was deleted.

0 commit comments

Comments
 (0)