'Test QueryDict with two key/value pairs with same keys.'

def test_multiple_keys(self):

    q = QueryDict(str(u'vote=yes&vote=no'))
    self.assertEqual(q[u'vote'], u'no')
    self.assertRaises(AttributeError, q.__setitem__, u'something', u'bar')
    self.assertEqual(q.get(u'vote', u'default'), u'no')
    self.assertEqual(q.get(u'foo', u'default'), u'default')
    self.assertEqual(q.getlist(u'vote'), [u'yes', u'no'])
    self.assertEqual(q.getlist(u'foo'), [])
    self.assertRaises(AttributeError, q.setlist, u'foo', [u'bar', u'baz'])
    self.assertRaises(AttributeError, q.setlist, u'foo', [u'bar', u'baz'])
    self.assertRaises(AttributeError, q.appendlist, u'foo', [u'bar'])
    if six.PY2:
        self.assertEqual(q.has_key(u'vote'), True)
    self.assertEqual((u'vote' in q), True)
    if six.PY2:
        self.assertEqual(q.has_key(u'foo'), False)
    self.assertEqual((u'foo' in q), False)
    self.assertEqual(list(six.iteritems(q)), [(u'vote', u'no')])
    self.assertEqual(list(six.iterlists(q)), [(u'vote', [u'yes', u'no'])])
    self.assertEqual(list(six.iterkeys(q)), [u'vote'])
    self.assertEqual(list(six.itervalues(q)), [u'no'])
    self.assertEqual(len(q), 1)
    self.assertRaises(AttributeError, q.update, {u'foo': u'bar'})
    self.assertRaises(AttributeError, q.pop, u'foo')
    self.assertRaises(AttributeError, q.popitem)
    self.assertRaises(AttributeError, q.clear)
    self.assertRaises(AttributeError, q.setdefault, u'foo', u'bar')
    self.assertRaises(AttributeError, q.__delitem__, u'vote')
