From adaee7b97e3604ef61df5099de932dacd01ec4cb Mon Sep 17 00:00:00 2001 From: David Wendt Date: Mon, 2 May 2022 11:00:48 -0400 Subject: [PATCH] add pytest for zero-length match --- python/cudf/cudf/tests/test_string.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/cudf/cudf/tests/test_string.py b/python/cudf/cudf/tests/test_string.py index d600fdeee27..d212c6b2072 100644 --- a/python/cudf/cudf/tests/test_string.py +++ b/python/cudf/cudf/tests/test_string.py @@ -923,6 +923,16 @@ def test_string_replace( assert_eq(expect, got) +@pytest.mark.parametrize("pat", ["A*", "F?H?"]) +def test_string_replace_zero_length(ps_gs, pat): + ps, gs = ps_gs + + expect = ps.str.replace(pat, "_", regex=True) + got = gs.str.replace(pat, "_", regex=True) + + assert_eq(expect, got) + + def test_string_lower(ps_gs): ps, gs = ps_gs