Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions python/cudf/cudf/tests/dataframe/test_binops.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,19 @@ def test_empty_column(binary_op, data, scalar):
assert_eq(expected, got, check_dtype=False)


DOT_OTHER_FACTORIES = [
lambda: cudf.DataFrame([[9, 10], [11, 12], [13, 14], [15, 16]]),
lambda: cudf.DataFrame(
[[9.4, 10.5], [11.6, 12.7], [13.8, 14.9], [15.1, 16.2]]
),
lambda: cudf.Series([5, 6, 7, 8]),
lambda: cudf.Series([5.6, 6.7, 7.8, 8.9]),
lambda: np.array([5, 6, 7, 8]),
# rapids-pre-commit-hooks: disable-next-line
lambda: [25.5, 26.6, 27.7, 28.8],
]


@pytest.mark.parametrize(
"df",
[
Expand All @@ -652,30 +665,20 @@ def test_empty_column(binary_op, data, scalar):
lambda: cudf.Series([14.15, 15.16, 16.17, 17.18]),
],
)
@pytest.mark.parametrize(
"other",
[
lambda: cudf.DataFrame([[9, 10], [11, 12], [13, 14], [15, 16]]),
lambda: cudf.DataFrame(
[[9.4, 10.5], [11.6, 12.7], [13.8, 14.9], [15.1, 16.2]]
),
lambda: cudf.Series([5, 6, 7, 8]),
lambda: cudf.Series([5.6, 6.7, 7.8, 8.9]),
lambda: np.array([5, 6, 7, 8]),
# rapids-pre-commit-hooks: disable-next-line
lambda: [25.5, 26.6, 27.7, 28.8],
],
)
def test_binops_dot(df, other):
def test_binops_dot(df):
df = df()
other = other()
pdf = df.to_pandas()
host_other = other.to_pandas() if hasattr(other, "to_pandas") else other

expected = pdf @ host_other
got = df @ other
for other_factory in DOT_OTHER_FACTORIES:
other = other_factory()
host_other = (
other.to_pandas() if hasattr(other, "to_pandas") else other
)

assert_eq(expected, got)
expected = pdf @ host_other
got = df @ other

assert_eq(expected, got)


def test_binop_dot_preserve_index():
Expand Down
Loading