Skip to content

Commit 1159466

Browse files
fix future warning causing ci failure
1 parent f25468a commit 1159466

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pandas/core/strings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=None):
582582
# in pat, still take it as a literal, and raise the Future warning
583583
if regex is None and len(pat) == 1 and re.findall(r"\W", pat):
584584
warnings.warn("'%s' is interpreted as a literal in " % pat +
585-
"default, not regex. The default will change in the "
586-
"future", FutureWarning)
585+
"default, not regex. It will change in the future."
586+
, FutureWarning)
587587
f = lambda x: x.replace(pat, repl, n)
588588

589589
return _na_map(f, arr)

pandas/tests/test_strings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2917,6 +2917,7 @@ def test_partition_deprecation(self):
29172917
result = values.str.rpartition(pat='_')
29182918
tm.assert_frame_equal(result, expected)
29192919

2920+
@pytest.mark.filterwarnings("ignore: '|' is interpreted as a literal")
29202921
def test_pipe_failures(self):
29212922
# #2119
29222923
s = Series(['A|B|C'])
@@ -2926,7 +2927,7 @@ def test_pipe_failures(self):
29262927

29272928
tm.assert_series_equal(result, exp)
29282929

2929-
result = s.str.replace('|', ' ', regex=False)
2930+
result = s.str.replace('|', ' ', regex=None)
29302931
exp = Series(['A B C'])
29312932

29322933
tm.assert_series_equal(result, exp)
@@ -3427,6 +3428,7 @@ def test_method_on_bytes(self):
34273428
['ad', 'be', 'cf'], 'S2').astype(object))
34283429
tm.assert_series_equal(result, expected)
34293430

3431+
@pytest.mark.filterwarnings("ignore: '.' is interpreted as a literal")
34303432
@pytest.mark.parametrize("regex, expected_array", [
34313433
(True, ['foofoofoo', 'foofoofoo']),
34323434
(False, ['abc', '123']),
@@ -3439,6 +3441,7 @@ def test_replace_single_pattern(self, regex, expected_array):
34393441
expected = Series(expected_array)
34403442
tm.assert_series_equal(result, expected)
34413443

3444+
@pytest.mark.filterwarnings("ignore: '.' is interpreted as a literal")
34423445
def test_replace_without_specifying_regex_parameter(self):
34433446
values = Series(['a.c'])
34443447
# GH: 24804

0 commit comments

Comments
 (0)