| 580 | |
| 581 | |
| 582 | def test_count_substring_regex(): |
| 583 | for (ty, offset) in [(pa.string(), pa.int32()), |
| 584 | (pa.large_string(), pa.int64())]: |
| 585 | arr = pa.array(["ab", "cab", "baAacaa", "ba", "AB", None], type=ty) |
| 586 | |
| 587 | result = pc.count_substring_regex(arr, "a+") |
| 588 | expected = pa.array([1, 1, 3, 1, 0, None], type=offset) |
| 589 | assert expected.equals(result) |
| 590 | |
| 591 | result = pc.count_substring_regex(arr, "a+", ignore_case=True) |
| 592 | expected = pa.array([1, 1, 2, 1, 1, None], type=offset) |
| 593 | assert expected.equals(result) |
| 594 | |
| 595 | |
| 596 | def test_find_substring(): |