@@ -233,14 +233,22 @@ def test_contains_nan(any_string_dtype):
233
233
expected = Series ([True , True , True ], dtype = expected_dtype )
234
234
tm .assert_series_equal (result , expected )
235
235
236
- result = s .str .contains ("foo" , na = "foo" )
237
- if any_string_dtype == "object" :
238
- expected = Series (["foo" , "foo" , "foo" ], dtype = np .object_ )
239
- elif any_string_dtype .na_value is np .nan :
240
- expected = Series ([True , True , True ], dtype = np .bool_ )
241
- else :
242
- expected = Series ([True , True , True ], dtype = "boolean" )
243
- tm .assert_series_equal (result , expected )
236
+ # this particular combination of events is broken on 2.3
237
+ # would require cherry picking #58483, which in turn requires #57481
238
+ # which introduce many behavioral changes
239
+ if not (
240
+ hasattr (any_string_dtype , "storage" )
241
+ and any_string_dtype .storage == "python"
242
+ and any_string_dtype .na_value is np .nan
243
+ ):
244
+ result = s .str .contains ("foo" , na = "foo" )
245
+ if any_string_dtype == "object" :
246
+ expected = Series (["foo" , "foo" , "foo" ], dtype = np .object_ )
247
+ elif any_string_dtype .na_value is np .nan :
248
+ expected = Series ([True , True , True ], dtype = np .bool_ )
249
+ else :
250
+ expected = Series ([True , True , True ], dtype = "boolean" )
251
+ tm .assert_series_equal (result , expected )
244
252
245
253
result = s .str .contains ("foo" )
246
254
expected_dtype = (
0 commit comments