Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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')
Beispiel #4
0
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')
Beispiel #5
0
def test_Config_defaults_empty_section():
    config = Config(defaults=True)
    config.set_defaults(a={})
    assert not 'a' in config
    assert not config.has_key('a')
    assert not config.has_section('a')
Beispiel #6
0
def test_Config_defaults_empty_section():
    config = Config(defaults=True)
    config.set_defaults(a={})
    assert not 'a' in config
    assert not config.has_key('a')
    assert not config.has_section('a')