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

Class TzLocalTest

tests/test_tz.py:793–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791
792@pytest.mark.tzlocal
793class TzLocalTest(unittest.TestCase):
794 def testEquality(self):
795 tz1 = tz.tzlocal()
796 tz2 = tz.tzlocal()
797
798 # Explicitly calling == and != here to ensure the operators work
799 self.assertTrue(tz1 == tz2)
800 self.assertFalse(tz1 != tz2)
801
802 def testInequalityFixedOffset(self):
803 tzl = tz.tzlocal()
804 tzos = tz.tzoffset('LST', tzl._std_offset.total_seconds())
805 tzod = tz.tzoffset('LDT', tzl._std_offset.total_seconds())
806
807 self.assertFalse(tzl == tzos)
808 self.assertFalse(tzl == tzod)
809 self.assertTrue(tzl != tzos)
810 self.assertTrue(tzl != tzod)
811
812 def testInequalityInvalid(self):
813 tzl = tz.tzlocal()
814
815 self.assertTrue(tzl != 1)
816 self.assertFalse(tzl == 1)
817
818 # TODO: Use some sort of universal local mocking so that it's clear
819 # that we're expecting tzlocal to *not* be Pacific/Kiritimati
820 LINT = tz.gettz('Pacific/Kiritimati')
821 self.assertTrue(tzl != LINT)
822 self.assertFalse(tzl == LINT)
823
824 def testInequalityUnsupported(self):
825 tzl = tz.tzlocal()
826
827 self.assertTrue(tzl == ComparesEqual)
828 self.assertFalse(tzl != ComparesEqual)
829
830 def testRepr(self):
831 tzl = tz.tzlocal()
832
833 self.assertEqual(repr(tzl), 'tzlocal()')
834
835
836@pytest.mark.parametrize('args,kwargs', [

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected