Ticket #17990: test-17990.diff

File test-17990.diff, 708 bytes (added by Mariusz Felisiak, 4 years ago)

Regression test.

  • tests/ordering/tests.py

    diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py
    index fe319b3859..a04e2674ed 100644
    a b class OrderingTests(TestCase):  
    194194            len(list(Article.objects.order_by("?"))), 4
    195195        )
    196196
     197    def test_random_ordering_distinct(self):
     198        author = Author.objects.create()
     199        Article.objects.update(author=author)
     200        self.assertSequenceEqual(
     201            Author.objects.filter(article__in=[self.a1, self.a2]).order_by('?').distinct(),
     202            [author],
     203        )
     204
    197205    def test_reversed_ordering(self):
    198206        """
    199207        Ordering can be reversed using the reverse() method on a queryset.
Back to Top