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

Method test_tzinfo_utcnow

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

Source from the content-addressed store, hash-verified

5387 self.assertEqual(expected, got.replace(tzinfo=None))
5388
5389 def test_tzinfo_utcnow(self):
5390 meth = self.theclass.utcnow
5391 # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up).
5392 with self.assertWarns(DeprecationWarning):
5393 base = meth()
5394 # Try with and without naming the keyword; for whatever reason,
5395 # utcnow() doesn't accept a tzinfo argument.
5396 off42 = FixedOffset(42, "42")
5397 self.assertRaises(TypeError, meth, off42)
5398 self.assertRaises(TypeError, meth, tzinfo=off42)
5399
5400 def test_tzinfo_utcfromtimestamp(self):
5401 import time

Callers

nothing calls this directly

Calls 4

methFunction · 0.85
FixedOffsetClass · 0.85
assertWarnsMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected