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

Method test_time

Lib/test/test_logging.py:4751–4763  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4749 self.assertRaises(ValueError, logging.Formatter, None, None, 'x')
4750
4751 def test_time(self):
4752 r = self.get_record()
4753 dt = datetime.datetime(1993, 4, 21, 8, 3, 0, 0, utc)
4754 # We use None to indicate we want the local timezone
4755 # We're essentially converting a UTC time to local time
4756 r.created = time.mktime(dt.astimezone(None).timetuple())
4757 r.msecs = 123
4758 f = logging.Formatter('%(asctime)s %(message)s')
4759 f.converter = time.gmtime
4760 self.assertEqual(f.formatTime(r), '1993-04-21 08:03:00,123')
4761 self.assertEqual(f.formatTime(r, '%Y:%d'), '1993:21')
4762 f.format(r)
4763 self.assertEqual(r.asctime, '1993-04-21 08:03:00,123')
4764
4765 def test_default_msec_format_none(self):
4766 class NoMsecFormatter(logging.Formatter):

Callers

nothing calls this directly

Calls 7

get_recordMethod · 0.95
formatTimeMethod · 0.95
formatMethod · 0.95
datetimeMethod · 0.80
astimezoneMethod · 0.80
timetupleMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected