def test_handler_multiple_registration(self): """ Confirm that `ReporterLogHandler#clear()` works normally with `ReporterLogHandler` registered in two loggers. """ rlh = ReporterLogHandler() rlh2 = ReporterLogHandler() logger = logging.getLogger("testlogger") logger.addHandler(rlh) logger.addHandler(rlh2) logger.warn("test message") rlh.clear()
def test_clear(self): """ Confirm that the existing log is deleted when `ReportLogHandler#clear()` is executed without calling `ReportLogHandler#get_text()` after outputting some log. """ rlh = ReporterLogHandler() logger = logging.getLogger("testlogger") logger.addHandler(rlh) logger.warn("test message") logger.warn("test message") rlh.clear() self.assertFalse(rlh.has_text)