def test_Config_defaults_option(): config = Config(defaults=True) config.set_defaults(a=10) assert 'a' in config assert config.has_key('a') assert config.has_option('a') assert config['a'] == 10 assert config.get('a') == 10 assert config.get_option('a') == 10 assert len(config) == 0 assert not 'a' in config.dictionary
def test_Config_defaults_section(): config = Config(defaults=True) config.set_defaults(a={'x': 1}) assert 'a' in config assert config.has_key('a') assert config.has_section('a') assert isinstance(config['a'], Section) assert len(config) == 1 assert len(config['a']) == 0 assert config['a'].has_option('x') assert config.get('a') == config['a'] assert config.get_section('a') == config['a'] config['a'] = {'y': 2} assert len(config['a']) == 1 assert config['a'].has_option('x') assert config['a'].has_option('y') del config['a'] assert config.has_section('a') assert len(config['a']) == 0 assert config['a'].has_option('x')