Skip to content

Commit 74fb4f9

Browse files
authored
BUG: add tests for empty prefix and suffix
1 parent c64ef05 commit 74fb4f9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pandas/tests/strings/test_strings.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,12 @@ def test_strip_lstrip_rstrip_args(any_string_dtype, method, exp):
544544

545545

546546
@pytest.mark.parametrize(
547-
"prefix, expected", [("a", ["b", " b c", "bc"]), ("ab", ["", "a b c", "bc"])]
547+
"prefix, expected",
548+
[
549+
("a", ["b", " b c", "bc"]),
550+
("ab", ["", "a b c", "bc"]),
551+
("", ["ab", "a b c", "bc"]),
552+
],
548553
)
549554
def test_removeprefix(any_string_dtype, prefix, expected):
550555
ser = Series(["ab", "a b c", "bc"], dtype=any_string_dtype)
@@ -554,7 +559,12 @@ def test_removeprefix(any_string_dtype, prefix, expected):
554559

555560

556561
@pytest.mark.parametrize(
557-
"suffix, expected", [("c", ["ab", "a b ", "b"]), ("bc", ["ab", "a b c", ""])]
562+
"suffix, expected",
563+
[
564+
("c", ["ab", "a b ", "b"]),
565+
("bc", ["ab", "a b c", ""]),
566+
("", ["ab", "a b c", "bc"]),
567+
],
558568
)
559569
def test_removesuffix(any_string_dtype, suffix, expected):
560570
ser = Series(["ab", "a b c", "bc"], dtype=any_string_dtype)
@@ -563,6 +573,7 @@ def test_removesuffix(any_string_dtype, suffix, expected):
563573
tm.assert_series_equal(result, ser_expected)
564574

565575

576+
566577
def test_string_slice_get_syntax(any_string_dtype):
567578
ser = Series(
568579
["YYY", "B", "C", "YYYYYYbYYY", "BYYYcYYY", np.nan, "CYYYBYYY", "dog", "cYYYt"],

0 commit comments

Comments
 (0)