From 603fdbb82ed7ddb762e8d194263c4b064b8945cd Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Tue, 8 Nov 2022 18:17:40 +0000 Subject: [PATCH] Test division by zero with Series as well --- python/cudf/cudf/tests/test_binops.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/python/cudf/cudf/tests/test_binops.py b/python/cudf/cudf/tests/test_binops.py index 7a3701ffc23..1216d8562d3 100644 --- a/python/cudf/cudf/tests/test_binops.py +++ b/python/cudf/cudf/tests/test_binops.py @@ -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(