MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_fromutc

Method test_fromutc

Lib/test/datetimetester.py:352–362  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

350 with self.assertRaises(TypeError): self.EST.tzname(5)
351
352 def test_fromutc(self):
353 with self.assertRaises(ValueError):
354 timezone.utc.fromutc(self.DT)
355 with self.assertRaises(TypeError):
356 timezone.utc.fromutc('not datetime')
357 for tz in [self.EST, self.ACDT, Eastern]:
358 utctime = self.DT.replace(tzinfo=tz)
359 local = tz.fromutc(utctime)
360 self.assertEqual(local - utctime, tz.utcoffset(local))
361 self.assertEqual(local,
362 self.DT.replace(tzinfo=timezone.utc))
363
364 def test_comparison(self):
365 self.assertNotEqual(timezone(ZERO), timezone(HOUR))

Callers

nothing calls this directly

Calls 5

assertRaisesMethod · 0.45
fromutcMethod · 0.45
replaceMethod · 0.45
assertEqualMethod · 0.45
utcoffsetMethod · 0.45

Tested by

no test coverage detected