Skip to content

Commit b6cc52c

Browse files
committed
force step dtypes in expected values
1 parent 261ee2f commit b6cc52c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test__grib_idx.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def test_build_idx_grib_mapping(self):
247247
f"{mapping_fname}.idx_grib_mapping.parquet",
248248
)
249249
# Build the mapping from idx to cfgrib metadata and assert it matches the fixture
250-
pd.testing.assert_frame_equal(mapping, pd.read_parquet(test_path))
250+
expected = pd.read_parquet(test_path)
251+
pd.testing.assert_frame_equal(mapping, expected.assign(step=lambda x: x.step.astype("timedelta64[ns]")))
251252

252253
# parse the idx files for 20231104 and compare the mapped result to the direct indexed result
253254
test_name = fnames["20231104"]
@@ -284,6 +285,8 @@ def test_build_idx_grib_mapping(self):
284285
)
285286
expected = pd.read_parquet(kindex_test_path)
286287

288+
expected = expected.assign(step=lambda x: x.step.astype("timedelta64[ns]"))
289+
287290
expected = expected.set_index(
288291
["varname", "typeOfLevel", "stepType", "step", "level"]
289292
).sort_index()
@@ -382,7 +385,8 @@ def test_kerchunk_indexing(self):
382385
TEST_DATE,
383386
f"{fname}.kindex.parquet",
384387
)
385-
pd.testing.assert_frame_equal(kindex, pd.read_parquet(test_path))
388+
expected = pd.read_parquet(test_path)
389+
pd.testing.assert_frame_equal(kindex, expected.assign(step=lambda x: x.step.astype("timedelta64[ns]")))
386390

387391
@unittest.skip("TODO")
388392
def test_extract_dataset_chunk_index(self):
@@ -428,7 +432,7 @@ def _test_index_extraction(self, sample_prefix: str):
428432
THIS_DIR, "grib_idx_fixtures", sample_prefix, "kerchunk_index.parquet"
429433
)
430434
expected = pd.read_parquet(test_path)
431-
pd.testing.assert_frame_equal(k_index, expected)
435+
pd.testing.assert_frame_equal(k_index, expected.assign(step=lambda x: x.step.astype("timedelta64[ns]")))
432436

433437
def test_strip_datavar_chunks(self):
434438
for sample_prefix, pre, post in [

0 commit comments

Comments
 (0)