From eda8e2de41b943c77ba175367c5478919809acc2 Mon Sep 17 00:00:00 2001 From: Liang Yan Date: Wed, 7 Jun 2023 18:07:05 +0800 Subject: [PATCH] TST: Add test for timedelta of fraction GH#9048 Signed-off-by: Liang Yan --- pandas/tests/tools/test_to_timedelta.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/tests/tools/test_to_timedelta.py b/pandas/tests/tools/test_to_timedelta.py index 92db9af275340..828f991eccfa6 100644 --- a/pandas/tests/tools/test_to_timedelta.py +++ b/pandas/tests/tools/test_to_timedelta.py @@ -293,6 +293,11 @@ def test_to_timedelta_numeric_ea(self, any_numeric_ea_dtype): expected = Series([pd.Timedelta(1, unit="ns"), pd.NaT]) tm.assert_series_equal(result, expected) + def test_to_timedelta_fraction(self): + result = to_timedelta(1.0 / 3, unit="h") + expected = pd.Timedelta("0 days 00:19:59.999999998") + assert result == expected + def test_from_numeric_arrow_dtype(any_numeric_ea_dtype): # GH 52425