MCPcopy Create free account
hub / github.com/apache/arrow / test_find_substring

Function test_find_substring

python/pyarrow/tests/test_compute.py:596–610  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

594
595
596def test_find_substring():
597 for ty in [pa.string(), pa.binary(), pa.large_string(), pa.large_binary()]:
598 arr = pa.array(["ab", "cab", "ba", None], type=ty)
599 result = pc.find_substring(arr, "ab")
600 assert result.to_pylist() == [0, 1, -1, None]
601
602 result = pc.find_substring_regex(arr, "a?b")
603 assert result.to_pylist() == [0, 1, 0, None]
604
605 arr = pa.array(["ab*", "cAB*", "ba", "aB?"], type=ty)
606 result = pc.find_substring(arr, "aB*", ignore_case=True)
607 assert result.to_pylist() == [0, 1, -1, -1]
608
609 result = pc.find_substring_regex(arr, "a?b", ignore_case=True)
610 assert result.to_pylist() == [0, 1, 0, 0]
611
612
613def test_match_like():

Callers

nothing calls this directly

Calls 2

stringMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected