Skip to content

Commit

Permalink
Add test of #14159
Browse files Browse the repository at this point in the history
  • Loading branch information
wence- committed Mar 22, 2024
1 parent 5c00e79 commit 999bb19
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/cudf/cudf/tests/dataframe/test_io_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from io import BytesIO

import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import pytest

Expand Down Expand Up @@ -35,3 +36,12 @@ def test_dataframe_parquet_roundtrip(index, write_index, empty):
gpu_read = cudf.read_parquet(gpu_buf)
cpu_read = cudf.read_parquet(cpu_buf)
assert_eq(gpu_read, cpu_read)


@pytest.mark.parametrize("preserve_index", [False, True, None])
def test_dataframe_to_arrow_preserve_index(preserve_index):
df = cudf.DataFrame({"x": ["cat", "dog"] * 5})
pf = df.to_pandas()
expect = pa.Table.from_pandas(pf, preserve_index=preserve_index).schema
got = df.to_arrow(preserve_index=preserve_index).schema
assert expect == got

0 comments on commit 999bb19

Please sign in to comment.