def test_mode_append(self): """Function: test_mode_append Description: Test with append mode setting. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, mode="a") self.assertTrue(log_file.handler)
def test_mode_default(self): """Function: test_mode_default Description: Test with default mode setting. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name) self.assertTrue(log_file.handler)
def test_default_setting(self): """Function: test_default_setting Description: Test with default settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name) self.assertEqual(log_file.log.level, 20)
def test_mode_write(self): """Function: test_mode_write Description: Test with write mode setting. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, mode="w") self.assertTrue(log_file.handler)
def test_info_setting(self): """Function: test_info_setting Description: Test with info settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="INFO") self.assertEqual(log_file.log.level, 20)
def test_debug_setting(self): """Function: test_debug_setting Description: Test with debug settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="DEBUG") self.assertEqual(log_file.log.level, 10)
def test_warning_setting(self): """Function: test_warning_setting Description: Test with warning settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="WARNING") self.assertEqual(log_file.log.level, 30)
def test_error_setting(self): """Function: test_error_setting Description: Test with error settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="ERROR") self.assertEqual(log_file.log.level, 40)
def test_critical_setting(self): """Function: test_critical_setting Description: Test with critical settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="CRITICAL") self.assertEqual(log_file.log.level, 50)
def test_default_setting(self): """Function: test_default_setting Description: Test with default settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="ERROR") log_file.log_err("TEST") self.assertEqual(open(self.f_name, 'r').read().count('ERROR TEST'), 1)
def test_default_setting(self): """Function: test_default_setting Description: Test with default settings. Arguments: """ log_file = gen_class.Logger(self.name, self.f_name, level="INFO") log_file.log_info("TEST") log_file.log_close() self.assertEqual(log_file.log.handlers, [])