Skip to content

Commit

Permalink
Still skip cudf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Oct 10, 2024
1 parent 8c834c7 commit 17e6747
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions tests/test_cudf.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import datetime

import pytest

import pyarrow as pa
import awkward as ak
import pyarrow as pa
import pytest

pytest.importorskip("akimbo.cudf")

import akimbo.cudf
import akimbo.io
import cudf

cudf = pytest.importorskip("cudf")


def test_operator_overload():
Expand Down Expand Up @@ -40,20 +39,31 @@ def test_inner_slicing():


def test_string_methods():
s = pa.array([{"s": ["hey", "Ho"], "i": [0]}, {"s": ["Gar", "go"], "i": [2]}],
type=pa.struct([("s", pa.list_(pa.string())), ("i", pa.list_(pa.int32()))]))
s = pa.array(
[{"s": ["hey", "Ho"], "i": [0]}, {"s": ["Gar", "go"], "i": [2]}],
type=pa.struct([("s", pa.list_(pa.string())), ("i", pa.list_(pa.int32()))]),
)
series = cudf.Series(s)
s2 = series.ak.str.upper()
assert s2.ak.to_list() == [{"s": ["HEY", "HO"], "i": [0]}, {"s": ["GAR", "GO"], "i": [2]}]
assert s2.ak.to_list() == [
{"s": ["HEY", "HO"], "i": [0]},
{"s": ["GAR", "GO"], "i": [2]},
]

assert series.ak.str.upper.__doc__
# kwargs
s2 = series.ak.str.replace(pat="h", repl="B")
assert s2.ak.to_list() == [{"s": ["Bey", "Ho"], "i": [0]}, {"s": ["Gar", "go"], "i": [2]}]
assert s2.ak.to_list() == [
{"s": ["Bey", "Ho"], "i": [0]},
{"s": ["Gar", "go"], "i": [2]},
]

# positional args
s2 = series.ak.str.replace("h", "B")
assert s2.ak.to_list() == [{"s": ["Bey", "Ho"], "i": [0]}, {"s": ["Gar", "go"], "i": [2]}]
assert s2.ak.to_list() == [
{"s": ["Bey", "Ho"], "i": [0]},
{"s": ["Gar", "go"], "i": [2]},
]

# non-str output
s2 = series.ak.str.len()
Expand All @@ -63,12 +73,12 @@ def test_string_methods():
def test_cast():
s = cudf.Series([0, 1, 2])
# shows that cast to timestamp needs to be two-step in cudf
s2 = s.ak.cast('m8[s]').ak.cast('M8[s]')
s2 = s.ak.cast("m8[s]").ak.cast("M8[s]")
out = s2.ak.to_list()
assert out == [
datetime.datetime(1970, 1, 1, 0, 0),
datetime.datetime(1970, 1, 1, 0, 0, 1),
datetime.datetime(1970, 1, 1, 0, 0, 2)
datetime.datetime(1970, 1, 1, 0, 0, 2),
]


Expand All @@ -77,7 +87,7 @@ def test_times():
datetime.datetime(1970, 1, 1, 0, 0),
datetime.datetime(1970, 1, 1, 0, 0, 1),
None,
datetime.datetime(1970, 1, 1, 0, 0, 2)
datetime.datetime(1970, 1, 1, 0, 0, 2),
]
arr = ak.Array([[data], [], [data]])
s = akimbo.io.ak_to_series(arr, "cudf")
Expand Down

0 comments on commit 17e6747

Please sign in to comment.