diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py index 9b3cd41e41e..71c90ecb5ef 100644 --- a/tests/regressiontests/aggregation_regress/tests.py +++ b/tests/regressiontests/aggregation_regress/tests.py @@ -588,10 +588,15 @@ class AggregationTests(TestCase): ) publishers = publishers.annotate(n_books=Count("book")) + sorted_publishers = sorted(publishers, key=lambda x: x.name) self.assertEqual( - publishers[0].n_books, + sorted_publishers[0].n_books, 2 ) + self.assertEqual( + sorted_publishers[1].n_books, + 1 + ) self.assertEqual( sorted(p.name for p in publishers),