| 762 | |
| 763 | |
| 764 | def test_split_pattern_regex(): |
| 765 | arr = pa.array(["-foo---bar--", "---foo---b"]) |
| 766 | result = pc.split_pattern_regex(arr, pattern="-+") |
| 767 | expected = pa.array([["", "foo", "bar", ""], ["", "foo", "b"]]) |
| 768 | assert expected.equals(result) |
| 769 | |
| 770 | result = pc.split_pattern_regex(arr, "-+", max_splits=1) |
| 771 | expected = pa.array([["", "foo---bar--"], ["", "foo---b"]]) |
| 772 | assert expected.equals(result) |
| 773 | |
| 774 | with pytest.raises(NotImplementedError, |
| 775 | match="Cannot split in reverse with regex"): |
| 776 | result = pc.split_pattern_regex( |
| 777 | arr, pattern="---", max_splits=1, reverse=True) |
| 778 | |
| 779 | |
| 780 | def test_min_max(): |