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

Function test_trim

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

Source from the content-addressed store, hash-verified

656
657
658def test_trim():
659 # \u3000 is unicode whitespace
660 arr = pa.array([" foo", None, " \u3000foo bar \t"])
661 result = pc.utf8_trim_whitespace(arr)
662 expected = pa.array(["foo", None, "foo bar"])
663 assert expected.equals(result)
664
665 arr = pa.array([" foo", None, " \u3000foo bar \t"])
666 result = pc.ascii_trim_whitespace(arr)
667 expected = pa.array(["foo", None, "\u3000foo bar"])
668 assert expected.equals(result)
669
670 arr = pa.array([" foo", None, " \u3000foo bar \t"])
671 result = pc.utf8_trim(arr, characters=' f\u3000')
672 expected = pa.array(["oo", None, "oo bar \t"])
673 assert expected.equals(result)
674 # Positional option
675 result = pc.utf8_trim(arr, ' f\u3000')
676 expected = pa.array(["oo", None, "oo bar \t"])
677 assert expected.equals(result)
678
679
680def test_slice_compatibility():

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected