MCPcopy Create free account
hub / github.com/dateutil/dateutil / TzUTCTest

Class TzUTCTest

tests/test_tz.py:631–686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629###
630# Test Cases
631class TzUTCTest(unittest.TestCase):
632 def testSingleton(self):
633 UTC_0 = tz.tzutc()
634 UTC_1 = tz.tzutc()
635
636 self.assertIs(UTC_0, UTC_1)
637
638 def testOffset(self):
639 ct = datetime(2009, 4, 1, 12, 11, 13, tzinfo=tz.tzutc())
640
641 self.assertEqual(ct.utcoffset(), timedelta(seconds=0))
642
643 def testDst(self):
644 ct = datetime(2009, 4, 1, 12, 11, 13, tzinfo=tz.tzutc())
645
646 self.assertEqual(ct.dst(), timedelta(seconds=0))
647
648 def testTzName(self):
649 ct = datetime(2009, 4, 1, 12, 11, 13, tzinfo=tz.tzutc())
650 self.assertEqual(ct.tzname(), 'UTC')
651
652 def testEquality(self):
653 UTC0 = tz.tzutc()
654 UTC1 = tz.tzutc()
655
656 self.assertEqual(UTC0, UTC1)
657
658 def testInequality(self):
659 UTC = tz.tzutc()
660 UTCp4 = tz.tzoffset('UTC+4', 14400)
661
662 self.assertNotEqual(UTC, UTCp4)
663
664 def testInequalityInteger(self):
665 self.assertFalse(tz.tzutc() == 7)
666 self.assertNotEqual(tz.tzutc(), 7)
667
668 def testInequalityUnsupported(self):
669 self.assertEqual(tz.tzutc(), ComparesEqual)
670
671 def testRepr(self):
672 UTC = tz.tzutc()
673 self.assertEqual(repr(UTC), 'tzutc()')
674
675 def testTimeOnlyUTC(self):
676 # https://github.com/dateutil/dateutil/issues/132
677 # tzutc doesn't care
678 tz_utc = tz.tzutc()
679 self.assertEqual(dt_time(13, 20, tzinfo=tz_utc).utcoffset(),
680 timedelta(0))
681
682 def testAmbiguity(self):
683 # Pick an arbitrary datetime, this should always return False.
684 dt = datetime(2011, 9, 1, 2, 30, tzinfo=tz.tzutc())
685
686 self.assertFalse(tz.datetime_ambiguous(dt))
687
688

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected