[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 33dd8f5442
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…
Reference in New Issue