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

Method test_styled_adapter

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

Source from the content-addressed store, hash-verified

5943 self.assertIs(self.logger.manager, orig_manager)
5944
5945 def test_styled_adapter(self):
5946 # Test an example from the Cookbook.
5947 records = self.recording.records
5948 adapter = StyleAdapter(self.logger)
5949 adapter.warning('Hello, {}!', 'world')
5950 self.assertEqual(str(records[-1].msg), 'Hello, world!')
5951 self.assertEqual(records[-1].funcName, 'test_styled_adapter')
5952 adapter.log(logging.WARNING, 'Goodbye {}.', 'world')
5953 self.assertEqual(str(records[-1].msg), 'Goodbye world.')
5954 self.assertEqual(records[-1].funcName, 'test_styled_adapter')
5955
5956 def test_nested_styled_adapter(self):
5957 records = self.recording.records

Callers

nothing calls this directly

Calls 5

logMethod · 0.95
StyleAdapterClass · 0.85
strFunction · 0.85
warningMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected