| 566 | |
| 567 | |
| 568 | def test_count_substring(): |
| 569 | for (ty, offset) in [(pa.string(), pa.int32()), |
| 570 | (pa.large_string(), pa.int64())]: |
| 571 | arr = pa.array(["ab", "cab", "abcab", "ba", "AB", None], type=ty) |
| 572 | |
| 573 | result = pc.count_substring(arr, "ab") |
| 574 | expected = pa.array([1, 1, 2, 0, 0, None], type=offset) |
| 575 | assert expected == result |
| 576 | |
| 577 | result = pc.count_substring(arr, "ab", ignore_case=True) |
| 578 | expected = pa.array([1, 1, 2, 0, 1, None], type=offset) |
| 579 | assert expected == result |
| 580 | |
| 581 | |
| 582 | def test_count_substring_regex(): |