MCPcopy Create free account
hub / github.com/python/cpython / test_bad_zones

Method test_bad_zones

Lib/test/test_zoneinfo/test_zoneinfo.py:251–262  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

249 self.klass(bad_key)
250
251 def test_bad_zones(self):
252 bad_zones = [
253 b"", # Empty file
254 b"AAAA3" + b" " * 15, # Bad magic
255 # Truncated V2 file (should not loop indefinitely)
256 b"TZif2" + (b"\x00" * 39) + b"TZif2" + (b"\x00" * 39) + b"\n" + b"Part",
257 ]
258
259 for bad_zone in bad_zones:
260 fobj = io.BytesIO(bad_zone)
261 with self.assertRaises(ValueError):
262 self.klass.from_file(fobj)
263
264 def test_fromutc_errors(self):
265 key = next(iter(self.zones()))

Callers

nothing calls this directly

Calls 2

assertRaisesMethod · 0.45
from_fileMethod · 0.45

Tested by

no test coverage detected