MCPcopy Index your code
hub / github.com/python/cpython / test_fromutc_errors

Method test_fromutc_errors

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

Source from the content-addressed store, hash-verified

262 self.klass.from_file(fobj)
263
264 def test_fromutc_errors(self):
265 key = next(iter(self.zones()))
266 zone = self.zone_from_key(key)
267
268 bad_values = [
269 (datetime(2019, 1, 1, tzinfo=timezone.utc), ValueError),
270 (datetime(2019, 1, 1), ValueError),
271 (date(2019, 1, 1), TypeError),
272 (time(0), TypeError),
273 (0, TypeError),
274 ("2019-01-01", TypeError),
275 ]
276
277 for val, exc_type in bad_values:
278 with self.subTest(val=val):
279 with self.assertRaises(exc_type):
280 zone.fromutc(val)
281
282 def test_utc(self):
283 zi = self.klass("UTC")

Callers

nothing calls this directly

Calls 8

zonesMethod · 0.95
zone_from_keyMethod · 0.95
datetimeClass · 0.90
dateClass · 0.90
timeClass · 0.90
subTestMethod · 0.45
assertRaisesMethod · 0.45
fromutcMethod · 0.45

Tested by

no test coverage detected