@@ -308,23 +308,12 @@ def test_startswith_endswith_validate_na(request, any_string_dtype):
308
308
dtype = any_string_dtype ,
309
309
)
310
310
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" )
328
317
329
318
330
319
@pytest .mark .filterwarnings ("ignore:Downcasting object dtype arrays:FutureWarning" )
0 commit comments