示例#1
0
def test_dt_handling_raises_TypeError():
    with pytest.raises(TypeError, match="objects are not supported"):
        dth.parse({"date": "2019-05-04"})
示例#2
0
def test_dt_handling_with_time():
    date = dth.parse(dt.time(20, 5, 4))
    assert date == dt.time(20, 5, 4)
示例#3
0
def test_dt_handling_with_date():
    date = dth.parse(dt.date(2018, 5, 4))
    assert date == dt.datetime(2018, 5, 4)
示例#4
0
def test_dt_handling_str_10():
    date = dth.parse(dt_in="04/05/19")
    assert date == dt.datetime(2019, 5, 4)
示例#5
0
def test_dt_handling_with_dt():
    date = dth.parse(dt.datetime(2019, 5, 4, 15))
    assert date == dt.datetime(2019, 5, 4, 15)
示例#6
0
def test_dt_handling_str_9():
    date = dth.parse(dt_in="04-05-19")
    assert date == dt.datetime(2019, 5, 4)
示例#7
0
def test_dt_handling_with_format():
    date = dth.parse(dt_in="3 del 2 del 2019", dt_format="%d del %m del %Y")
    assert date == dt.datetime(2019, 2, 3)
示例#8
0
def test_dt_handling_str_7():
    date = dth.parse(dt_in="2019/5/4")
    assert date == dt.datetime(2019, 5, 4)
示例#9
0
def test_dt_handling_str_4():
    date = dth.parse(dt_in="5-4-2019")
    assert date == dt.datetime(2019, 5, 4)
示例#10
0
def test_dt_handling_str_2():
    date = dth.parse(dt_in="2019-05-04T15:00:00.112000")
    assert date == dt.datetime(2019, 5, 4, 15, 0, 0, 112000)
示例#11
0
def test_dt_handling_timestamp_millisecs():
    date = dth.parse(dt_in=1565805808000)
    assert date == dt.datetime(2019, 8, 14, 15, 3, 28)
示例#12
0
def test_dt_handling_with_format_raises_TypeError():
    with pytest.raises(TypeError):
        dth.parse(dt_in=123456789, dt_format="%d del %m del %Y")