Skip to content

Commit 564c7b2

Browse files
Backport PR #60700 on branch 2.3.x (TST(string dtype): Resolve xfail in test_find_replace.py) (#60708)
Backport PR #60700: TST(string dtype): Resolve xfail in test_find_replace.py Co-authored-by: Richard Shadrach <[email protected]>
1 parent 07c6cad commit 564c7b2

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

pandas/tests/strings/test_find_replace.py

+6-17
Original file line numberDiff line numberDiff line change
@@ -308,23 +308,12 @@ def test_startswith_endswith_validate_na(request, any_string_dtype):
308308
dtype=any_string_dtype,
309309
)
310310

311-
dtype = ser.dtype
312-
if (isinstance(dtype, pd.StringDtype)) or dtype == np.dtype("object"):
313-
msg = "Allowing a non-bool 'na' in obj.str.startswith is deprecated"
314-
with tm.assert_produces_warning(FutureWarning, match=msg):
315-
ser.str.startswith("kapow", na="baz")
316-
msg = "Allowing a non-bool 'na' in obj.str.endswith is deprecated"
317-
with tm.assert_produces_warning(FutureWarning, match=msg):
318-
ser.str.endswith("bar", na="baz")
319-
else:
320-
# TODO(infer_string): don't surface pyarrow errors
321-
import pyarrow as pa
322-
323-
msg = "Could not convert 'baz' with type str: tried to convert to boolean"
324-
with pytest.raises(pa.lib.ArrowInvalid, match=msg):
325-
ser.str.startswith("kapow", na="baz")
326-
with pytest.raises(pa.lib.ArrowInvalid, match=msg):
327-
ser.str.endswith("kapow", na="baz")
311+
msg = "Allowing a non-bool 'na' in obj.str.startswith is deprecated"
312+
with tm.assert_produces_warning(FutureWarning, match=msg):
313+
ser.str.startswith("kapow", na="baz")
314+
msg = "Allowing a non-bool 'na' in obj.str.endswith is deprecated"
315+
with tm.assert_produces_warning(FutureWarning, match=msg):
316+
ser.str.endswith("bar", na="baz")
328317

329318

330319
@pytest.mark.filterwarnings("ignore:Downcasting object dtype arrays:FutureWarning")

0 commit comments

Comments
 (0)