From 2f6312fcd13a6dd6b62393663b75b230f2e1bc96 Mon Sep 17 00:00:00 2001 From: Christopher Wang Date: Tue, 3 Nov 2020 22:15:17 -0800 Subject: [PATCH] Fixed #32168 -- Removed serial pk assumption in aggregation_regress tests. --- tests/aggregation_regress/tests.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 29ffe1f058..877e7b49a7 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -876,7 +876,7 @@ class AggregationTests(TestCase): ) # Note: intentionally no order_by(), that case needs tests, too. - publishers = Publisher.objects.filter(id__in=[1, 2]) + publishers = Publisher.objects.filter(id__in=[self.p1.id, self.p2.id]) self.assertEqual( sorted(p.name for p in publishers), [ @@ -1450,8 +1450,10 @@ class AggregationTests(TestCase): query = Book.objects.annotate(Count('authors')).filter( q1 | q2).order_by('pk') self.assertQuerysetEqual( - query, [1, 4, 5, 6], - lambda b: b.pk) + query, + [self.b1.pk, self.b4.pk, self.b5.pk, self.b6.pk], + attrgetter('pk'), + ) def test_ticket_11293_q_immutable(self): """