From 045481bce1b743eceaa79fd2741f2c250e6a029e Mon Sep 17 00:00:00 2001 From: Irina Truong Date: Wed, 12 Jul 2023 03:52:15 -0700 Subject: [PATCH] Ensure writing works with partition_freq (#44) --- tests/test_write.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_write.py b/tests/test_write.py index f6b9e35..817c583 100644 --- a/tests/test_write.py +++ b/tests/test_write.py @@ -26,7 +26,8 @@ False, ], ) -def test_roundtrip(tmpdir, with_index): +@pytest.mark.parametrize("freq,partition_freq", [("1H", "1D"), ("1H", "1w")]) +def test_roundtrip(tmpdir, with_index, freq, partition_freq): dtypes = { "str": object, # FIXME: Categorical data does not work @@ -38,9 +39,8 @@ def test_roundtrip(tmpdir, with_index): ddf = timeseries( start="2023-01-01", end="2023-01-15", - # FIXME: Setting the partition frequency destroys the roundtrip for some - # reason - # partition_freq="1w", + freq=freq, + partition_freq=partition_freq, dtypes=dtypes, ) @@ -58,6 +58,7 @@ def test_roundtrip(tmpdir, with_index): if with_index: ddf = ddf.reset_index() + assert ddf.npartitions == ddf_read.npartitions # By default, arrow reads with ns resolution ddf.timestamp = ddf.timestamp.astype("datetime64[ns]") assert_eq(ddf, ddf_read)