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

Method test_percent

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

Source from the content-addressed store, hash-verified

4599 return logging.makeLogRecord(result)
4600
4601 def test_percent(self):
4602 # Test %-formatting
4603 r = self.get_record()
4604 f = logging.Formatter('${%(message)s}')
4605 self.assertEqual(f.format(r), '${Message with 2 placeholders}')
4606 f = logging.Formatter('%(random)s')
4607 self.assertRaises(ValueError, f.format, r)
4608 self.assertFalse(f.usesTime())
4609 f = logging.Formatter('%(asctime)s')
4610 self.assertTrue(f.usesTime())
4611 f = logging.Formatter('%(asctime)-15s')
4612 self.assertTrue(f.usesTime())
4613 f = logging.Formatter('%(asctime)#15s')
4614 self.assertTrue(f.usesTime())
4615
4616 def test_braces(self):
4617 # Test {}-formatting

Callers

nothing calls this directly

Calls 7

get_recordMethod · 0.95
formatMethod · 0.95
usesTimeMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected