def test_mappings(self): """Make sure mapping-type values get merged.""" dest = { 'line': { 'properties': { 'path': { # A key will be added within this. 'type': 'string', 'index': 'not_analyzed' } } # A key will be added after this mapping-valued key. }, 'dash': { # This key's value will be unchanged. 'nothing': 'here' } } source = { 'line': { 'properties': { 'path': { 'new': 'thing' } }, 'floperties': { 'a': 'flop' } } } eq_(deep_update(dest, source), { 'line': { 'properties': { 'path': { 'type': 'string', 'index': 'not_analyzed', 'new': 'thing' } }, 'floperties': { 'a': 'flop' } }, 'dash': { 'nothing': 'here' } })
def test_mappings(self): """Make sure mapping-type values get merged.""" dest = { 'line': { 'properties': { 'path': { # A key will be added within this. 'type': 'string', 'index': 'not_analyzed' } } # A key will be added after this mapping-valued key. }, 'dash': { # This key's value will be unchanged. 'nothing': 'here' } } source = { 'line': { 'properties': { 'path': { 'new': 'thing' } }, 'floperties': { 'a': 'flop' } } } eq_( deep_update(dest, source), { 'line': { 'properties': { 'path': { 'type': 'string', 'index': 'not_analyzed', 'new': 'thing' } }, 'floperties': { 'a': 'flop' } }, 'dash': { 'nothing': 'here' } })
def test_overwrites(self): """Non-mapping keys should be overwritten.""" eq_(deep_update(dict(a=8), dict(a=9)), dict(a=9))