24 lines
645 B
Python
24 lines
645 B
Python
import pandas as pd
|
||
from sp2xr import csv_to_parquet
|
||
|
||
|
||
def test_csv_to_parquet_roundtrip(tmp_path):
|
||
# --- create synthetic mini‑dataset ---
|
||
original = pd.DataFrame(
|
||
{
|
||
"particle_id": [1, 2, 3],
|
||
"incand": [123.4, 234.5, 345.6],
|
||
"scat": [10.1, 11.2, 12.3],
|
||
}
|
||
)
|
||
csv_file = tmp_path / "sample.csv"
|
||
pq_file = tmp_path / "sample.parquet"
|
||
original.to_csv(csv_file, index=False)
|
||
|
||
# --- run the code under test ---
|
||
csv_to_parquet(csv_file, pq_file)
|
||
|
||
# --- validate ---
|
||
roundtrip = pd.read_parquet(pq_file)
|
||
pd.testing.assert_frame_equal(roundtrip, original)
|