#!/usr/bin/env python
"""
open/DurusWorks/qp/lib/test/utest_tz.py

"""
from datetime import datetime
from qp.lib import tz
from sancho.utest import UTest


class Test(UTest):

    def a(self):
        eastern = datetime(
            year=2000, month=12, day=1, hour=10,
            tzinfo=tz.Eastern)
        central = eastern.astimezone(tz.Central)
        mountain = eastern.astimezone(tz.Mountain)
        pacific = eastern.astimezone(tz.Pacific)
        assert eastern.hour == central.hour + 1
        assert eastern.hour == mountain.hour + 2
        assert eastern.hour == pacific.hour + 3
        utc = eastern.astimezone(tz.UTC)
        utc_plus_1 = eastern.astimezone(tz.UTC_plus_1)
        assert utc.hour == eastern.hour + 5
        est = datetime(
            year=2000, month=6, day=1, hour=18,
            tzinfo=tz.Eastern)
        utc2 = est.astimezone(tz.UTC)
        assert utc2.hour == est.hour + 4
        eastern_now = tz.Eastern.now()
        central_now = tz.Eastern.now()
        tz.now()

if __name__ == '__main__':
    Test()
