Files
SP2XR/tests/test_roundtrip.py

24 lines
645 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import pandas as pd
from sp2xr import csv_to_parquet
def test_csv_to_parquet_roundtrip(tmp_path):
# --- create synthetic minidataset ---
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)