Beispiel #1
0
def test_parse_time():
    now = datetime.now()

    time_fmt1 = "10:20"
    time_fmt2 = "12:32:21"

    assert try_parse_time(now) == now.time()
    assert try_parse_time(now.time()) == now.time()
    assert try_parse_time(time_fmt1) == time(10, 20)
    assert try_parse_time(time_fmt2) == time(12, 32, 21)
    assert try_parse_time("12341") is None
Beispiel #2
0
def test_parse_time():
    now = datetime.now()

    time_fmt1 = "10:20"
    time_fmt2 = "12:32:21"

    assert try_parse_time(now) == now.time()
    assert try_parse_time(now.time()) == now.time()
    assert try_parse_time(time_fmt1) == time(10, 20)
    assert try_parse_time(time_fmt2) == time(12, 32, 21)
    assert try_parse_time("12341") is None