Skip to content

Commit 89c2913

Browse files
committed
enh(op.TC) check pandas inputs/results dont scream
1 parent b7b73e8 commit 89c2913

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

test/test_op.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from textwrap import dedent
99
from types import SimpleNamespace
1010

11+
import pandas as pd
1112
import pytest
1213

1314
from graphtik import (
@@ -28,14 +29,9 @@
2829
tasks_in_parallel,
2930
tasks_marshalled,
3031
)
32+
from graphtik.fnop import FnOp, Operation, as_renames, reparse_operation_data
3133
from graphtik.modifier import dep_renamed
3234
from graphtik.planning import yield_ops
33-
from graphtik.fnop import (
34-
FnOp,
35-
Operation,
36-
as_renames,
37-
reparse_operation_data,
38-
)
3935

4036

4137
@pytest.fixture(params=[None, "got"])
@@ -711,3 +707,17 @@ def test_conveyor_identity_fn():
711707
# provides=["C", "B", "A", varargs(sadasa"b", 's')]
712708
# )()
713709
# assert op(c=7, a=5, b=[6]) == {"A": 5, "B1": [6], "B2", "C": 7}
710+
711+
712+
def test_pandas_result():
713+
ser = pd.Series([1, 2])
714+
sol = operation(lambda: ser, name="pandas", provides="a").compute()
715+
assert (sol["a"] == ser).all()
716+
717+
718+
def test_pandas_input():
719+
ser = pd.Series([1, 2])
720+
sol = operation(fn=None, name="pandas", needs="a", provides="A")(a=ser)
721+
assert (sol["A"] == ser).all()
722+
sol = operation(fn=None, name="pandas", needs="a", provides="A").compute({"a": ser})
723+
assert (sol["A"] == ser).all()

0 commit comments

Comments
 (0)