'MergeDict can merge MultiValueDicts'

def test_mergedict_merges_multivaluedict(self):

    multi1 = MultiValueDict({'key1': ['value1'], 'key2': ['value2', 'value3']})
    multi2 = MultiValueDict({'key2': ['value4'], 'key4': ['value5', 'value6']})
    mm = MergeDict(multi1, multi2)
    self.assertEquals(mm.getlist('key2'), ['value2', 'value3'])
    self.assertEquals(mm.getlist('key4'), ['value5', 'value6'])
    self.assertEquals(mm.getlist('undefined'), [])
    self.assertEquals(sorted(mm.keys()), ['key1', 'key2', 'key4'])
    self.assertEquals(len(mm.values()), 3)
    self.assertTrue(('value1' in mm.values()))
    self.assertEquals(sorted(mm.items(), key=(lambda k: k[0])), [('key1', 'value1'), ('key2', 'value3'), ('key4', 'value6')])
    self.assertEquals([(k, mm.getlist(k)) for k in sorted(mm)], [('key1', ['value1']), ('key2', ['value2', 'value3']), ('key4', ['value5', 'value6'])])
