@@ -293,23 +293,12 @@ def test_startswith_endswith_validate_na(any_string_dtype):
293293 dtype = any_string_dtype ,
294294 )
295295
296- dtype = ser .dtype
297- if (isinstance (dtype , pd .StringDtype )) or dtype == np .dtype ("object" ):
298- msg = "Allowing a non-bool 'na' in obj.str.startswith is deprecated"
299- with tm .assert_produces_warning (FutureWarning , match = msg ):
300- ser .str .startswith ("kapow" , na = "baz" )
301- msg = "Allowing a non-bool 'na' in obj.str.endswith is deprecated"
302- with tm .assert_produces_warning (FutureWarning , match = msg ):
303- ser .str .endswith ("bar" , na = "baz" )
304- else :
305- # TODO(infer_string): don't surface pyarrow errors
306- import pyarrow as pa
307-
308- msg = "Could not convert 'baz' with type str: tried to convert to boolean"
309- with pytest .raises (pa .lib .ArrowInvalid , match = msg ):
310- ser .str .startswith ("kapow" , na = "baz" )
311- with pytest .raises (pa .lib .ArrowInvalid , match = msg ):
312- ser .str .endswith ("kapow" , na = "baz" )
296+ msg = "Allowing a non-bool 'na' in obj.str.startswith is deprecated"
297+ with tm .assert_produces_warning (FutureWarning , match = msg ):
298+ ser .str .startswith ("kapow" , na = "baz" )
299+ msg = "Allowing a non-bool 'na' in obj.str.endswith is deprecated"
300+ with tm .assert_produces_warning (FutureWarning , match = msg ):
301+ ser .str .endswith ("bar" , na = "baz" )
313302
314303
315304@pytest .mark .parametrize ("pat" , ["foo" , ("foo" , "baz" )])
0 commit comments