| 2027 | self.assertEqual(repr(tzc), 'tzfile(' + repr('foo') + ')') |
| 2028 | |
| 2029 | def testLeapCountDecodesProperly(self): |
| 2030 | # This timezone has leapcnt, and failed to decode until |
| 2031 | # Eugene Oden notified about the issue. |
| 2032 | |
| 2033 | # As leap information is currently unused (and unstored) by tzfile() we |
| 2034 | # can only indirectly test this: Take advantage of tzfile() not closing |
| 2035 | # the input file if handed in as an opened file and assert that the |
| 2036 | # full file content has been read by tzfile(). Note: For this test to |
| 2037 | # work NEW_YORK must be in TZif version 1 format i.e. no more data |
| 2038 | # after TZif v1 header + data has been read |
| 2039 | fileobj = BytesIO(base64.b64decode(NEW_YORK)) |
| 2040 | tz.tzfile(fileobj) |
| 2041 | # we expect no remaining file content now, i.e. zero-length; if there's |
| 2042 | # still data we haven't read the file format correctly |
| 2043 | remaining_tzfile_content = fileobj.read() |
| 2044 | self.assertEqual(len(remaining_tzfile_content), 0) |
| 2045 | |
| 2046 | def testIsStd(self): |
| 2047 | # NEW_YORK tzfile contains this isstd information: |