Skip to content

Commit f0264f9

Browse files
committed
negative
1 parent 5374d8b commit f0264f9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/tests/arrays/test_integer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,17 @@ def test_error(self, data, all_arithmetic_operators):
339339
with pytest.raises(NotImplementedError):
340340
opa(np.arange(len(s)).reshape(-1, len(s)))
341341

342-
def test_divide_by_zero(self):
342+
@pytest.mark.parametrize("zero, negative", [(0, False), (0.0, False), (-0.0, True)])
343+
def test_divide_by_zero(self, zero, negative):
343344
# https://github.com/pandas-dev/pandas/issues/27398
344345
a = pd.array([0, 1, -1, None], dtype="Int64")
345-
result = a / 0
346+
result = a / zero
346347
expected = np.array([np.nan, np.inf, -np.inf, np.nan])
348+
if negative:
349+
values = [np.nan, -np.inf, np.inf, np.nan]
350+
else:
351+
values = [np.nan, np.inf, -np.inf, np.nan]
352+
expected = np.array(values)
347353
tm.assert_numpy_array_equal(result, expected)
348354

349355
def test_pow(self):

0 commit comments

Comments
 (0)