Refs #7070 -- Improved test for extra(), values(), distinct() and ordering() all together.

Tested that the extra select that appears in the select clause only because of
distinct() and order_by() doesn't appear in the result values.
This commit is contained in:
Sergey Fedoseev 2017-08-08 23:38:43 +05:00 committed by Tim Graham
parent b8731c3fff
commit c754bdc45b
1 changed files with 2 additions and 1 deletions

View File

@ -433,4 +433,5 @@ class ExtraRegressTests(TestCase):
self.assertSequenceEqual(qs.order_by('-second_extra'), [t2.pk, t1.pk]) self.assertSequenceEqual(qs.order_by('-second_extra'), [t2.pk, t1.pk])
# Note: the extra ordering must appear in select clause, so we get two # Note: the extra ordering must appear in select clause, so we get two
# non-distinct results here (this is on purpose, see #7070). # non-distinct results here (this is on purpose, see #7070).
self.assertSequenceEqual(qs.order_by('-second_extra').values_list('first', flat=True), ['a', 'a']) # Extra select doesn't appear in result values.
self.assertSequenceEqual(qs.order_by('-second_extra').values_list('first'), [('a',), ('a',)])