File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1962,6 +1962,27 @@ def test_str_find_negative_start_negative_end():
1962
1962
tm .assert_series_equal (result , expected )
1963
1963
1964
1964
1965
+ def test_str_find_large_start ():
1966
+ # GH 56791
1967
+ ser = pd .Series (["abcdefg" , None ], dtype = ArrowDtype (pa .string ()))
1968
+ if pa_version_under13p0 :
1969
+ # https://github.com/apache/arrow/issues/36311
1970
+ with pytest .raises (pa .lib .ArrowInvalid , match = "Negative buffer resize" ):
1971
+ ser .str .find (sub = "d" , start = 16 )
1972
+ else :
1973
+ result = ser .str .find (sub = "d" , start = 16 )
1974
+ expected = pd .Series ([- 1 , None ], dtype = ArrowDtype (pa .int64 ()))
1975
+ tm .assert_series_equal (result , expected )
1976
+
1977
+
1978
+ def test_str_find_negative_start_negative_end_no_match ():
1979
+ # GH 56791
1980
+ ser = pd .Series (["abcdefg" , None ], dtype = ArrowDtype (pa .string ()))
1981
+ result = ser .str .find (sub = "d" , start = - 3 , end = - 6 )
1982
+ expected = pd .Series ([- 1 , None ], dtype = ArrowDtype (pa .int64 ()))
1983
+ tm .assert_series_equal (result , expected )
1984
+
1985
+
1965
1986
@pytest .mark .parametrize (
1966
1987
"i, exp" ,
1967
1988
[
You can’t perform that action at this time.
0 commit comments