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