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

Class TzLocalTest

tests/test_tz.py:800–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected