def test_from_and_to_properties(self):
        properties = [Property('a'),
                      Property('a.b', 5, int, '\d+', True, True, 'doc'),
                      Property('b', 5, int, '\d+', True, True, 'doc')]

        conf = Configuration.from_properties(properties)
        assert properties == list(conf.to_properties())
        assert 'a' in conf
        assert 'a.b' in conf
        assert 'b' in conf
示例#2
0
    def test_from_and_to_properties(self):
        properties = [Property('a'),
                      Property('a.b', 5, int, '\d+', True, True, 'doc'),
                      Property('b', 5, int, '\d+', True, True, 'doc')]

        conf = Configuration.from_properties(properties)
        assert properties == list(conf.to_properties())
        assert 'a' in conf
        assert 'a.b' in conf
        assert 'b' in conf
示例#3
0
 def test_replace_changes_existing(self):
     conf = Configuration.from_properties([Property('b', 'old')])
     newvalues = {'b': 'replaced'}
     assert newvalues == conf.replace(newvalues)
示例#4
0
 def test_update(self):
     conf = Configuration.from_properties([Property('b', 'old')])
     newvalues = {'b': 'replaced', 'c': 'new'}
     assert newvalues == conf.update(newvalues)
示例#5
0
    def test_attribute_access(self):
        p = Property('b', 5, int, '\d+', True, True, 'doc')
        conf = Configuration.from_properties([p])

        assert 5 == conf['b']
        assert p == conf.property('b')
 def test_replace_changes_existing(self):
     conf = Configuration.from_properties([Property('b', 'old')])
     newvalues = {'b': 'replaced'}
     assert newvalues == conf.replace(newvalues)
 def test_update(self):
     conf = Configuration.from_properties([Property('b', 'old')])
     newvalues = {'b': 'replaced', 'c': 'new'}
     assert newvalues == conf.update(newvalues)
    def test_attribute_access(self):
        p = Property('b', 5, int, '\d+', True, True, 'doc')
        conf = Configuration.from_properties([p])

        assert 5 == conf['b']
        assert p == conf.property('b')