def test_check_setting_bool(self): """ Test check_setting_bool """ # setup CFG = ConfigObj('config.ini', encoding='UTF-8', options={'indent_type': ' '}) config.check_section(CFG, 'General') CFG['General']['debug'] = True CFG['General']['season_folders_default'] = False CFG['General']['dbdebug'] = None # normal self.assertTrue(config.check_setting_bool(CFG, 'General', 'debug')) self.assertFalse( config.check_setting_bool(CFG, 'General', 'season_folders_default', def_val=True)) # None value type self.assertFalse( config.check_setting_bool(CFG, 'General', 'dbdebug', False)) # unmatched item self.assertTrue( config.check_setting_bool(CFG, 'General', 'git_reset', def_val=True)) # unmatched section self.assertFalse( config.check_setting_bool(CFG, 'Subtitles', 'use_subtitles', def_val=False)) # wrong def_val type, silent = off self.assertTrue( config.check_setting_bool(CFG, 'General', 'debug', def_val=['fail'], silent=False))
def test_check_setting_bool(self): """ Test check_setting_bool """ # setup CFG = ConfigObj('config.ini', encoding='UTF-8') config.check_section(CFG, 'General') CFG['General']['debug'] = True CFG['General']['season_folders_default'] = False CFG['General']['dbdebug'] = None # normal self.assertTrue(config.check_setting_bool(CFG, 'General', 'debug')) self.assertFalse(config.check_setting_bool(CFG, 'General', 'season_folders_default', def_val=True)) # None value type self.assertFalse(config.check_setting_bool( CFG, 'General', 'dbdebug', False)) # unmatched item self.assertTrue(config.check_setting_bool(CFG, 'General', 'git_reset', def_val=True)) # unmatched section self.assertFalse(config.check_setting_bool(CFG, 'Subtitles', 'use_subtitles', def_val=False)) # wrong def_val type, silent = off self.assertTrue(config.check_setting_bool( CFG, 'General', 'debug', def_val=['fail'], silent=False))