Skip to content

Commit

Permalink
Test division by zero with Series as well
Browse files Browse the repository at this point in the history
  • Loading branch information
wence- committed Nov 8, 2022
1 parent 77d94d1 commit 603fdbb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions python/cudf/cudf/tests/test_binops.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,15 +881,20 @@ def test_binop_bool_uint(func, rhs):
"series_dtype", (np.bool_, np.int8, np.uint8, np.int64, np.uint64)
)
@pytest.mark.parametrize(
"scalar_dtype", (np.bool_, np.int8, np.uint8, np.int64, np.uint64)
"divisor_dtype", (np.bool_, np.int8, np.uint8, np.int64, np.uint64)
)
def test_floordiv_zero_float64(series_dtype, scalar_dtype):
@pytest.mark.parametrize("scalar_divisor", [False, True])
def test_floordiv_zero_float64(series_dtype, divisor_dtype, scalar_divisor):
sr = pd.Series([1, 2, 3], dtype=series_dtype)
cr = cudf.from_pandas(sr)

utils.assert_eq(
(sr // scalar_dtype(0)), (cr // cudf.Scalar(0, dtype=scalar_dtype))
)
if scalar_divisor:
pd_div = divisor_dtype(0)
cudf_div = cudf.Scalar(0, dtype=divisor_dtype)
else:
pd_div = pd.Series([0], dtype=divisor_dtype)
cudf_div = cudf.from_pandas(pd_div)
utils.assert_eq((sr // pd_div), (cr // cudf_div))


@pytest.mark.parametrize(
Expand Down

0 comments on commit 603fdbb

Please sign in to comment.