Exemplo n.º 1
0
def test_parse_ms_precision():
    base = '2013-07-03T16:34:52'
    digits = '1234567890'
    
    parsed = jsonutil.parse_date(base)
    nt.assert_is_instance(parsed, datetime.datetime)
    for i in range(len(digits)):
        ts = base + '.' + digits[:i]
        parsed = jsonutil.parse_date(ts)
        if i >= 1 and i <= 6:
            nt.assert_is_instance(parsed, datetime.datetime)
        else:
            nt.assert_is_instance(parsed, str)
Exemplo n.º 2
0
def test_parse_ms_precision():
    base = '2013-07-03T16:34:52'
    digits = '1234567890'

    parsed = jsonutil.parse_date(base)
    nt.assert_is_instance(parsed, datetime.datetime)
    for i in range(len(digits)):
        ts = base + '.' + digits[:i]
        parsed = jsonutil.parse_date(ts)
        if i >= 1 and i <= 6:
            nt.assert_is_instance(parsed, datetime.datetime)
        else:
            nt.assert_is_instance(parsed, str)