'Regression test for #10256... If there is a values() clause, Extra
columns are only returned if they are explicitly mentioned.'

def test_values_with_extra(self):

    obj = TestObject(first=u'first', second=u'second', third=u'third')
    obj.save()
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values()), [{u'bar': u'second', u'third': u'third', u'second': u'second', u'whiz': u'third', u'foo': u'first', u'id': obj.pk, u'first': u'first'}])
    self.assertEqual(list(TestObject.objects.values().extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third'))))), [{u'bar': u'second', u'third': u'third', u'second': u'second', u'whiz': u'third', u'foo': u'first', u'id': obj.pk, u'first': u'first'}])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values(u'first', u'second')), [{u'second': u'second', u'first': u'first'}])
    self.assertEqual(list(TestObject.objects.values(u'first', u'second').extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third'))))), [{u'second': u'second', u'first': u'first'}])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values(u'first', u'second', u'foo')), [{u'second': u'second', u'foo': u'first', u'first': u'first'}])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values(u'foo', u'whiz')), [{u'foo': u'first', u'whiz': u'third'}])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list()), [(u'first', u'second', u'third', obj.pk, u'first', u'second', u'third')])
    self.assertEqual(list(TestObject.objects.values_list().extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third'))))), [(u'first', u'second', u'third', obj.pk, u'first', u'second', u'third')])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'first', u'second')), [(u'first', u'second')])
    self.assertEqual(list(TestObject.objects.values_list(u'first', u'second').extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third'))))), [(u'first', u'second')])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'second', flat=True)), [u'second'])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'first', u'second', u'whiz')), [(u'first', u'second', u'third')])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'foo', u'whiz')), [(u'first', u'third')])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'whiz', flat=True)), [u'third'])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'whiz', u'foo')), [(u'third', u'first')])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'first', u'id')), [(u'first', obj.pk)])
    self.assertEqual(list(TestObject.objects.extra(select=SortedDict(((u'foo', u'first'), (u'bar', u'second'), (u'whiz', u'third')))).values_list(u'whiz', u'first', u'bar', u'id')), [(u'third', u'first', u'second', obj.pk)])
