def test_add_named_logger_to_function(self): self.assertFalse(hasattr(sample_function, "_log")) _add_logger_to(sample_function, logger_name=named_logger.name) self.assertEqual(named_logger.name, sample_function._log.name)
def test_add_named_logger_to_class(self): self.assertFalse(hasattr(SampleClass, "_SampleClass__log")) _add_logger_to(SampleClass, logger_name=named_logger.name) self.assertEqual(named_logger.name, SampleClass._SampleClass__log.name)
def test_add_default_logger_to_function(self): self.assertFalse(hasattr(sample_function, "_log")) _add_logger_to(sample_function) self.assertEqual(__name__, sample_function._log.name)
def test_add_default_logger_to_class(self): self.assertFalse(hasattr(SampleClass, "_SampleClass__log")) _add_logger_to(SampleClass) self.assertEqual("%s.SampleClass" % __name__, SampleClass._SampleClass__log.name)