Example #1
0
def test_utc_from_iso_from_naive():
    msg = assert_raises(
        ValueError,
        util.utc_from_iso8601,
        '2011-11-T2:30:58.403397',
    )

    eq(str(msg), 'unknown string format')
Example #2
0
def test_utc_from_iso_no_timezone():
    msg = assert_raises(
        ValueError,
        util.utc_from_iso8601,
        '2011-11-17T2:30:58.403397',
    )

    eq(str(msg), 'string must contain timezome information')
Example #3
0
def test_utc_from_empty():
    msg = assert_raises(
        ValueError,
        util.utc_from_iso8601,
        '',
        )

    eq(str(msg), 'string cannot be empty')
Example #4
0
def test_utc_to_local_not_in_utc():
    dt = datetime(2011, 10, 12, 2, 30, 58, 403397, tz.tzlocal())
    msg = assert_raises(
        ValueError,
        util.utc_to_local,
        dt,
    )

    eq(str(msg), 'Datetime is not in UTC')
Example #5
0
def test_utc_to_local_from_naive():
    dt = datetime(2011, 10, 12, 2, 30, 58, 403397)
    msg = assert_raises(
        ValueError,
        util.utc_to_local,
        dt,
    )

    eq(str(msg), 'Datetime is not in UTC')