Skip to content
Snippets Groups Projects
test_time.py 504 B
Newer Older
from datetime import datetime


def test_to_unix_timestamp():
    from aosstower.time import to_unix_timestamp
    assert to_unix_timestamp(datetime(1970, 1, 1)) == 0


def test_hhmm_to_secs():
Bruce Flynn's avatar
Bruce Flynn committed
    from aosstower.time import hhmm_to_offset
Bruce Flynn's avatar
Bruce Flynn committed
    assert hhmm_to_offset('2400') == 86400, "Can't handle > 23:59"
    assert hhmm_to_offset('2401') == 86460, "Can't handle > 23:59"
    assert hhmm_to_offset('0') == 0, "Can't handle short times"
    assert hhmm_to_offset('001') == 60, "Can't handle leading 0"