(
np_dt_unit: NPDatetimeUnitOptions, time_unit: PDDatetimeUnitOptions
)
| 1066 | |
| 1067 | @pytest.mark.parametrize("np_dt_unit", ["D", "h", "m", "s", "ms", "us", "ns"]) |
| 1068 | def test_pd_timedelta_to_float( |
| 1069 | np_dt_unit: NPDatetimeUnitOptions, time_unit: PDDatetimeUnitOptions |
| 1070 | ): |
| 1071 | # tests any combination of source pd.Timedelta (NPDatetimeUnitOptions) with |
| 1072 | # np_timedelta_to_float with dedicated target unit (PDDatetimeUnitOptions) |
| 1073 | td = pd.Timedelta(1, np_dt_unit) |
| 1074 | expected = _NS_PER_TIME_DELTA[np_dt_unit] / _NS_PER_TIME_DELTA[time_unit] |
| 1075 | |
| 1076 | out = pd_timedelta_to_float(td, datetime_unit=time_unit) |
| 1077 | np.testing.assert_allclose(out, expected) |
| 1078 | assert isinstance(out, float) |
| 1079 | |
| 1080 | |
| 1081 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected
searching dependent graphs…