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

Method test_nested_inherited

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

Source from the content-addressed store, hash-verified

263 ])
264
265 def test_nested_inherited(self):
266 # Logging levels in a nested namespace, inherited from parent loggers.
267 m = self.next_message
268
269 INF = logging.getLogger("INF")
270 INF.setLevel(logging.INFO)
271 INF_ERR = logging.getLogger("INF.ERR")
272 INF_ERR.setLevel(logging.ERROR)
273 INF_UNDEF = logging.getLogger("INF.UNDEF")
274 INF_ERR_UNDEF = logging.getLogger("INF.ERR.UNDEF")
275 UNDEF = logging.getLogger("UNDEF")
276
277 # These should log.
278 INF_UNDEF.log(logging.CRITICAL, m())
279 INF_UNDEF.error(m())
280 INF_UNDEF.warning(m())
281 INF_UNDEF.info(m())
282 INF_ERR_UNDEF.log(logging.CRITICAL, m())
283 INF_ERR_UNDEF.error(m())
284
285 # These should not log.
286 INF_UNDEF.debug(m())
287 INF_ERR_UNDEF.warning(m())
288 INF_ERR_UNDEF.info(m())
289 INF_ERR_UNDEF.debug(m())
290
291 self.assert_log_lines([
292 ('INF.UNDEF', 'CRITICAL', '1'),
293 ('INF.UNDEF', 'ERROR', '2'),
294 ('INF.UNDEF', 'WARNING', '3'),
295 ('INF.UNDEF', 'INFO', '4'),
296 ('INF.ERR.UNDEF', 'CRITICAL', '5'),
297 ('INF.ERR.UNDEF', 'ERROR', '6'),
298 ])
299
300 def test_nested_with_virtual_parent(self):
301 # Logging levels when some parent does not exist yet.

Callers

nothing calls this directly

Calls 8

getLoggerMethod · 0.80
assert_log_linesMethod · 0.80
setLevelMethod · 0.45
logMethod · 0.45
errorMethod · 0.45
warningMethod · 0.45
infoMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected