test_time.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:utils 作者: rapydo 项目源码 文件源码
def test():

    t = timestamp_from_string("423423423")

    d = datetime(1983, 6, 2, 17, 37, 3, tzinfo=pytz.utc)
    assert t == d

    try:
        t = timestamp_from_string("asd")
    except ValueError:
        pass
    else:
        pytest.fail("This call should raise a ValueError")

    t = timestamp_from_string("0")
    d = datetime(1970, 1, 1, 0, 0, 0, tzinfo=pytz.utc)
    assert t == d

    t = timestamp_from_string("-1")
    d = datetime(1969, 12, 31, 23, 59, 59, tzinfo=pytz.utc)
    assert t == d
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号