def test_getboolean_invalid(self, yaml, log): yaml.load.side_effect = [{'test_bool': True}, {'test_bool': 'foo'}] settings.initialise() assert settings.getboolean('test_bool') is True log.warning.assert_called()
def test_getboolean(self, yaml): yaml.load.side_effect = [{'test_bool': True}, {}] settings.initialise() assert settings.getboolean('test_bool') is True
def test_initialise_empty_user_settings(self, yaml, save): yaml.load.side_effect = [{'tab_size': 4}, None] settings.initialise() assert settings['tab_size'] == 4 save.assert_called_once_with()
def test_initialise_with_user_settings(self, yaml, save): yaml.load.side_effect = [{'tab_size': 4}, {'tab_size': 2}] settings.initialise() assert settings['tab_size'] == 2 assert save.call_count == 0
def test_getfloat_invalid(self, yaml, log): yaml.load.side_effect = [{'test_float': 5.0}, {'test_float': 'foo'}] settings.initialise() assert settings.getfloat('test_float') == 5.0 log.warning.assert_called()
def test_getfloat(self, yaml): yaml.load.side_effect = [{'test_float': 5.0}, {}] settings.initialise() assert settings.getfloat('test_float') == 5.0