Beispiel #1
0
def test_hms_colons_short():
    """It returns only minutes and seconds, padded with zeros, delimited by colons."""
    secs = 302
    got = UT.hms(secs, colons=True)
    exp = "05:02"
    assert got == exp
Beispiel #2
0
def test_hms_exception():
    """It raises a ValueError Exception."""
    with pytest.raises(TypeError):
        UT.hms([])
Beispiel #3
0
def test_hms_colons_full():
    """It returns days, hours, minutes and seconds, padded with zeros, delimited by colons."""
    secs = 86400 + 7200 + 300 + 34
    got = UT.hms(secs, colons=True)
    exp = "01:02:05:34"
    assert got == exp
Beispiel #4
0
def test_hms_single():
    """It returns single letter labels."""
    secs = 86400 + 7200 + 300 + 34
    got = UT.hms(secs, single=True)
    exp = "1d 2h 5m 34s"
    assert got == exp
Beispiel #5
0
def test_hms_long():
    """It returns a full time string, with zero values."""
    secs = 67
    got = UT.hms(secs, small=False, short=False)
    exp = "0 days, 0 hours, 1 minute and 7 seconds"
    assert got == exp
Beispiel #6
0
def test_hms_small():
    """It returns a short time string."""
    secs = 67
    got = UT.hms(secs, short=False)
    exp = "1 minute and 7 seconds"
    assert got == exp
Beispiel #7
0
def test_hms_small_short():
    """It returns a short time string with short labels."""
    secs = 67
    got = UT.hms(secs)
    exp = "1 min and 7 secs"
    assert got == exp