Ejemplo n.º 1
0
    def test_should_fill_not_existed_keys(self):
        data = self.get_data()
        assert 'SLAVE' not in data['DATABASE']

        impl = self.dict_implementation
        dictquery.set(data, ['DATABASE', 'SLAVE', 'PORT'], 9999, dictfactory=impl)

        assert 'SLAVE' in data['DATABASE']
        assert 'PORT' in data['DATABASE']['SLAVE']
        assert data['DATABASE']['SLAVE']['PORT'] == 9999
Ejemplo n.º 2
0
    def test_should_set_neasted_elements(self):
        data = self.get_data()
        dictquery.set(data, ['DATABASE', 'testdata', 'fixtures'], 'other.json')

        fixtures = data['DATABASE']['testdata']['fixtures']
        assert fixtures == 'other.json'