From 920b43eb5b40190bb2dbee00773e17307bc699d8 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 2 May 2026 14:59:33 -0400 Subject: Removed hardcoded pks in annotations and delete_regress tests. --- tests/annotations/tests.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'tests/annotations') diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py index b94f44ef22..42fccca7d6 100644 --- a/tests/annotations/tests.py +++ b/tests/annotations/tests.py @@ -742,8 +742,7 @@ class NonAggregateAnnotationTestCase(TestCase): 4. model_related_fields """ store = Store.objects.first() - Employee.objects.create( - id=1, + e1 = Employee.objects.create( first_name="Max", manager=True, last_name="Paine", @@ -751,8 +750,7 @@ class NonAggregateAnnotationTestCase(TestCase): age=23, salary=Decimal(50000.00), ) - Employee.objects.create( - id=2, + e2 = Employee.objects.create( first_name="Buffy", manager=False, last_name="Summers", @@ -770,8 +768,18 @@ class NonAggregateAnnotationTestCase(TestCase): ) rows = [ - (1, "Max", True, 42, "Paine", 23, Decimal(50000.00), store.name, 17), - (2, "Buffy", False, 42, "Summers", 18, Decimal(40000.00), store.name, 17), + (e1.pk, "Max", True, 42, "Paine", 23, Decimal(50000.00), store.name, 17), + ( + e2.pk, + "Buffy", + False, + 42, + "Summers", + 18, + Decimal(40000.00), + store.name, + 17, + ), ] self.assertQuerySetEqual( @@ -792,8 +800,7 @@ class NonAggregateAnnotationTestCase(TestCase): def test_column_field_ordering_with_deferred(self): store = Store.objects.first() - Employee.objects.create( - id=1, + e1 = Employee.objects.create( first_name="Max", manager=True, last_name="Paine", @@ -801,8 +808,7 @@ class NonAggregateAnnotationTestCase(TestCase): age=23, salary=Decimal(50000.00), ) - Employee.objects.create( - id=2, + e2 = Employee.objects.create( first_name="Buffy", manager=False, last_name="Summers", @@ -820,8 +826,18 @@ class NonAggregateAnnotationTestCase(TestCase): ) rows = [ - (1, "Max", True, 42, "Paine", 23, Decimal(50000.00), store.name, 17), - (2, "Buffy", False, 42, "Summers", 18, Decimal(40000.00), store.name, 17), + (e1.pk, "Max", True, 42, "Paine", 23, Decimal(50000.00), store.name, 17), + ( + e2.pk, + "Buffy", + False, + 42, + "Summers", + 18, + Decimal(40000.00), + store.name, + 17, + ), ] # and we respect deferred columns! -- cgit v1.3