예제 #1
0
 def test_time_field_deserialization(self):
     field = fields.Time()
     t = dt.time(1, 23, 45)
     t_formatted = t.isoformat()
     result = field.deserialize(t_formatted)
     assert isinstance(result, dt.time)
     assert_time_equal(result, t)
     # With microseconds
     t2 = dt.time(1, 23, 45, 6789)
     t2_formatted = t2.isoformat()
     result2 = field.deserialize(t2_formatted)
     assert_time_equal(result2, t2)
 def test_time_field_deserialization(self):
     field = fields.Time()
     t = dt.time(1, 23, 45)
     t_formatted = t.isoformat()
     result = field.deserialize(t_formatted)
     assert isinstance(result, dt.time)
     assert_time_equal(result, t)
     # With microseconds
     t2 = dt.time(1, 23, 45, 6789)
     t2_formatted = t2.isoformat()
     result2 = field.deserialize(t2_formatted)
     assert_time_equal(result2, t2)
예제 #3
0
def test_from_iso_time_without_microseconds():
    t = dt.time(1, 23, 45)
    formatted = t.isoformat()
    result = utils.from_iso_time(formatted)
    assert type(result) == dt.time
    assert_time_equal(result, t)
예제 #4
0
def test_from_iso_time_without_microseconds(use_dateutil):
    t = dt.time(1, 23, 45)
    formatted = t.isoformat()
    result = utils.from_iso_time(formatted, use_dateutil=use_dateutil)
    assert type(result) == dt.time
    assert_time_equal(result, t, microseconds=True)
예제 #5
0
def test_from_iso_time_without_microseconds(use_dateutil):
    t = dt.time(1, 23, 45)
    formatted = t.isoformat()
    result = utils.from_iso_time(formatted, use_dateutil=use_dateutil)
    assert isinstance(result, dt.time)
    assert_time_equal(result, t, microseconds=True)
예제 #6
0
def test_from_iso_time_with_microseconds(use_dateutil):
    t = dt.time(1, 23, 45, 6789)
    formatted = t.isoformat()
    result = utils.from_iso_time(formatted, use_dateutil=use_dateutil)
    assert isinstance(result, dt.time)
    assert_time_equal(result, t, microseconds=True)
예제 #7
0
def test_from_iso_time_with_microseconds(use_dateutil):
    t = dt.time(1, 23, 45, 6789)
    formatted = t.isoformat()
    result = utils.from_iso_time(formatted, use_dateutil=use_dateutil)
    assert type(result) == dt.time
    assert_time_equal(result, t, microseconds=True)