def test_TimeDelta_string(tdsp): string, total_seconds = tdsp td = TimeDelta(string) print(string, td) assert td.total_seconds() == total_seconds assert td.to_string() == string
def test_TimeDelta_days(): td = TimeDelta("00:00:86400") assert td.to_string() == "1d+00:00:00"
def test_TimeDelta_total_seconds(tds0): string, total_seconds = tds0 td = TimeDelta(string) print(string, td) assert td.total_seconds() == total_seconds
def test_TimeDelta_nomicro(): td = TimeDelta("10d+1:2:3.0") assert td.to_string() == "10d+01:02:03"
def test_TimeDelta_negday(): td = TimeDelta("-1d+1:2:3.4") assert td.to_string() == "-1d+01:02:03.000004"
def test_TimeDelta_noday(): td = TimeDelta("0d+1:2:3.4") assert td.to_string() == "01:02:03.000004"
def test_TimeDelta_as_timedelta(): td = TimeDelta() assert isinstance(td.as_timedelta(), datetime.timedelta) assert not isinstance(td.as_timedelta(), TimeDelta)
def test_TimeDelta_default(): td = TimeDelta() td.to_string() assert td.total_seconds() == 0.0