From 3712d213e338939f876c411d5998937850b361f2 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Mon, 2 Sep 2024 07:50:29 +0200 Subject: [PATCH] Fix flaky test_to_from_pandas --- python/tests/rd_tests/test_rd_sum.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/tests/rd_tests/test_rd_sum.py b/python/tests/rd_tests/test_rd_sum.py index e0dac8b7d..08653c7f6 100644 --- a/python/tests/rd_tests/test_rd_sum.py +++ b/python/tests/rd_tests/test_rd_sum.py @@ -177,9 +177,12 @@ def test_to_from_pandas(summary): "TEST", baseline, dims=(smspec.nx, smspec.ny, smspec.nz) ).pandas_frame() - # round to hours - roundtrip.index = roundtrip.index.round(freq="H") - baseline.index = baseline.index.round(freq="H") + # Round to days because of precision loss due + # to file storing time as float32 days or hours since + # start date which is converted to float64 seconds internally + # and then to datetime64 in pandas + roundtrip.index = roundtrip.index.round(freq="D") + baseline.index = baseline.index.round(freq="D") assert_frame_equal( roundtrip,