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

Method testLeapCountDecodesProperly

tests/test_tz.py:2133–2148  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2131 self.assertEqual(repr(tzc), 'tzfile(' + repr('foo') + ')')
2132
2133 def testLeapCountDecodesProperly(self):
2134 # This timezone has leapcnt, and failed to decode until
2135 # Eugene Oden notified about the issue.
2136
2137 # As leap information is currently unused (and unstored) by tzfile() we
2138 # can only indirectly test this: Take advantage of tzfile() not closing
2139 # the input file if handed in as an opened file and assert that the
2140 # full file content has been read by tzfile(). Note: For this test to
2141 # work NEW_YORK must be in TZif version 1 format i.e. no more data
2142 # after TZif v1 header + data has been read
2143 fileobj = BytesIO(base64.b64decode(NEW_YORK))
2144 tz.tzfile(fileobj)
2145 # we expect no remaining file content now, i.e. zero-length; if there's
2146 # still data we haven't read the file format correctly
2147 remaining_tzfile_content = fileobj.read()
2148 self.assertEqual(len(remaining_tzfile_content), 0)
2149
2150 def testGMTHasNoDaylight(self):
2151 # tz.tzstr("GMT+2") improperly considered daylight saving time.

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected