Skip to content

Commit 7424f8a

Browse files
[ArrowStringArray] TST/CLN: cleanup str.replace tests (#41600)
1 parent 90882b8 commit 7424f8a

File tree

3 files changed

+256
-175
lines changed

3 files changed

+256
-175
lines changed

pandas/core/strings/accessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ def replace(
13541354
)
13551355
if len(pat) == 1:
13561356
msg += (
1357-
" In addition, single character regular expressions will"
1357+
" In addition, single character regular expressions will "
13581358
"*not* be treated as literal strings when regex=True."
13591359
)
13601360
warnings.warn(msg, FutureWarning, stacklevel=3)

pandas/tests/series/methods/test_replace.py

-11
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,3 @@ def test_replace_with_compiled_regex(self):
449449
result = s.replace({regex: "z"}, regex=True)
450450
expected = pd.Series(["z", "b", "c"])
451451
tm.assert_series_equal(result, expected)
452-
453-
@pytest.mark.parametrize("pattern", ["^.$", "."])
454-
def test_str_replace_regex_default_raises_warning(self, pattern):
455-
# https://github.com/pandas-dev/pandas/pull/24809
456-
s = pd.Series(["a", "b", "c"])
457-
msg = r"The default value of regex will change from True to False"
458-
if len(pattern) == 1:
459-
msg += r".*single character regular expressions.*not.*literal strings"
460-
with tm.assert_produces_warning(FutureWarning) as w:
461-
s.str.replace(pattern, "")
462-
assert re.match(msg, str(w[0].message))

0 commit comments

Comments
 (0)