@@ -2296,14 +2296,25 @@ def test_str_split_pat_none(method):
2296
2296
tm .assert_series_equal (result , expected )
2297
2297
2298
2298
2299
- def test_str_split_regex_none ():
2299
+ def test_str_split_regex_explicit ():
2300
2300
# GH 58321
2301
- ser = pd .Series (["230/270/270" , "240-290-290" ], dtype = ArrowDtype (pa .string ()))
2302
- result = ser .str .split (r"/|-" , regex = None )
2303
- expected = pd .Series (
2304
- ArrowExtensionArray (pa .array ([["230" , "270" , "270" ], ["240" , "290" , "290" ]]))
2305
- )
2306
- tm .assert_series_equal (result , expected )
2301
+ # adapted from tests/strings/test_split_partition.py
2302
+ values = pd .Series ("xxxjpgzzz.jpg" , dtype = ArrowDtype (pa .string ()))
2303
+
2304
+ # explicit regex = False split
2305
+ result = values .str .split (r"\.jpg" , regex = False )
2306
+ exp = pd .Series (ArrowExtensionArray (pa .array ([["xxxjpgzzz.jpg" ]])))
2307
+ tm .assert_series_equal (result , exp )
2308
+
2309
+ # non explicit regex split, pattern length == 1
2310
+ result = values .str .split (r"." )
2311
+ exp = pd .Series (ArrowExtensionArray (pa .array ([["xxxjpgzzz" , "jpg" ]])))
2312
+ tm .assert_series_equal (result , exp )
2313
+
2314
+ # non explicit regex split, pattern length != 1
2315
+ result = values .str .split (r".jpg" )
2316
+ exp = pd .Series (ArrowExtensionArray (pa .array ([["xx" , "zzz" , "" ]])))
2317
+ tm .assert_series_equal (result , exp )
2307
2318
2308
2319
2309
2320
def test_str_split ():
0 commit comments