Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt711 committed Oct 1, 2024
1 parent 07f84c2 commit 6d9e39d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions python/pylibcudf/pylibcudf/tests/test_string_char_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
import pyarrow as pa
import pyarrow.compute as pc
import pylibcudf as plc
from utils import assert_column_eq


def test_all_characters_of_type():
pa_array = pa.array(["1", "A"])
plc_result = plc.strings.char_types.all_characters_of_type(
result = plc.strings.char_types.all_characters_of_type(
plc.interop.from_arrow(pa_array),
plc.strings.char_types.StringCharacterTypes.ALPHA,
plc.strings.char_types.StringCharacterTypes.ALL_TYPES,
)
pa_result = plc.interop.to_arrow(plc_result)
pa_expected = pa.chunked_array([pc.utf8_is_alpha(pa_array)])
assert pa_result.equals(pa_expected)
expected = pa.chunked_array([pc.utf8_is_alpha(pa_array)])
assert_column_eq(result, expected)


def test_filter_characters_of_type():
pa_array = pa.array(["=A="])
plc_result = plc.strings.char_types.filter_characters_of_type(
result = plc.strings.char_types.filter_characters_of_type(
plc.interop.from_arrow(pa_array),
plc.strings.char_types.StringCharacterTypes.ALPHANUM,
plc.interop.from_arrow(pa.scalar(" ")),
plc.strings.char_types.StringCharacterTypes.ALL_TYPES,
)
pa_result = plc.interop.to_arrow(plc_result)
pa_expected = pa.chunked_array([pc.replace_substring(pa_array, "A", " ")])
assert pa_result.equals(pa_expected)
expected = pa.chunked_array([pc.replace_substring(pa_array, "A", " ")])
assert_column_eq(result, expected)

0 comments on commit 6d9e39d

Please sign in to comment.