Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
def test_TimeDelta_days():
    td = TimeDelta("00:00:86400")
    assert td.to_string() == "1d+00:00:00"
Ejemplo n.º 3
0
def test_TimeDelta_total_seconds(tds0):
    string, total_seconds = tds0
    td = TimeDelta(string)
    print(string, td)
    assert td.total_seconds() == total_seconds
Ejemplo n.º 4
0
def test_TimeDelta_nomicro():
    td = TimeDelta("10d+1:2:3.0")
    assert td.to_string() == "10d+01:02:03"
Ejemplo n.º 5
0
def test_TimeDelta_negday():
    td = TimeDelta("-1d+1:2:3.4")
    assert td.to_string() == "-1d+01:02:03.000004"
Ejemplo n.º 6
0
def test_TimeDelta_noday():
    td = TimeDelta("0d+1:2:3.4")
    assert td.to_string() == "01:02:03.000004"
Ejemplo n.º 7
0
def test_TimeDelta_as_timedelta():
    td = TimeDelta()
    assert isinstance(td.as_timedelta(), datetime.timedelta)
    assert not isinstance(td.as_timedelta(), TimeDelta)
Ejemplo n.º 8
0
def test_TimeDelta_default():
    td = TimeDelta()
    td.to_string()
    assert td.total_seconds() == 0.0