mirror of
https://github.com/django/django.git
synced 2025-06-04 19:19:13 +00:00
[1.4.x] Fixed random aggregation_regress test_more_more_more() failure
The cause was assuming that an unordered queryset returns the values always in the same order. Backport of 33dd8f544205be923e2a06106909ebcd3583526b
This commit is contained in:
parent
f2a9f71565
commit
83420e70ef
@ -587,10 +587,9 @@ class AggregationTests(TestCase):
|
||||
)
|
||||
|
||||
publishers = publishers.annotate(n_books=Count("book"))
|
||||
self.assertEqual(
|
||||
publishers[0].n_books,
|
||||
2
|
||||
)
|
||||
sorted_publishers = sorted(publishers, key=lambda x: x.name)
|
||||
self.assertEqual(sorted_publishers[0].n_books, 2)
|
||||
self.assertEqual(sorted_publishers[1].n_books, 1)
|
||||
|
||||
self.assertEqual(
|
||||
sorted(p.name for p in publishers),
|
||||
|
Loading…
x
Reference in New Issue
Block a user