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

Method setUp

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

Source from the content-addressed store, hash-verified

4294class LogRecordFactoryTest(BaseTest):
4295
4296 def setUp(self):
4297 class CheckingFilter(logging.Filter):
4298 def __init__(self, cls):
4299 self.cls = cls
4300
4301 def filter(self, record):
4302 t = type(record)
4303 if t is not self.cls:
4304 msg = 'Unexpected LogRecord type %s, expected %s' % (t,
4305 self.cls)
4306 raise TypeError(msg)
4307 return True
4308
4309 BaseTest.setUp(self)
4310 self.filter = CheckingFilter(DerivedLogRecord)
4311 self.root_logger.addFilter(self.filter)
4312 self.orig_factory = logging.getLogRecordFactory()
4313
4314 def tearDown(self):
4315 self.root_logger.removeFilter(self.filter)

Callers

nothing calls this directly

Calls 3

CheckingFilterClass · 0.85
addFilterMethod · 0.80
setUpMethod · 0.45

Tested by

no test coverage detected