Ejemplo n.º 1
0
    def test_conversion(self):
        t = CTime(0)

        self.assertEqual(t.value(), 0)
        self.assertEqual(t.ctime(), 0)
        self.assertEqual(t.time(), time.localtime(0))

        # These conversions depend on timezone
        utc = timezone('utc')
        local_timezone = timezone(CTime.timezone())

        localized_dt = local_timezone.localize(t.datetime())
        self.assertEqual(localized_dt.astimezone(utc), datetime(1970, 1, 1, 0, tzinfo=utc))

        localized_d = datetime(1970, 1, 1, 0, tzinfo=utc).astimezone(local_timezone)
        self.assertEqual(t.date(), localized_d.date())
Ejemplo n.º 2
0
    def test_conversion(self):
        t = CTime(0)

        self.assertEqual(t.value(), 0)
        self.assertEqual(t.ctime(), 0)
        self.assertEqual(t.time(), time.localtime(0))

        # These conversions depend on timezone
        utc = timezone('utc')
        local_timezone = timezone(CTime.timezone())

        localized_dt = local_timezone.localize(t.datetime())
        self.assertEqual(localized_dt.astimezone(utc),
                         datetime(1970, 1, 1, 0, tzinfo=utc))

        localized_d = datetime(1970, 1, 1, 0,
                               tzinfo=utc).astimezone(local_timezone)
        self.assertEqual(t.date(), localized_d.date())
Ejemplo n.º 3
0
    def test_conversion(self):
        t = CTime(0)

        self.assertEqual(t.value(), 0)
        self.assertEqual(t.ctime(), 0)
        self.assertEqual(t.time(), time.gmtime(0))
Ejemplo n.º 4
0
    def test_conversion(self):
        t = CTime(0)

        self.assertEqual(t.value(), 0)
        self.assertEqual(t.ctime(), 0)
        self.assertEqual(t.time(), time.gmtime(0))