summaryrefslogtreecommitdiff
path: root/tests/annotations
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2026-05-02 14:59:33 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2026-05-04 08:44:22 -0400
commit920b43eb5b40190bb2dbee00773e17307bc699d8 (patch)
tree5383fcc9ad07d49272aeabb39dee9823ad2a6e3b /tests/annotations
parentfba9413a326634606c54cd19ff3aefd8e50d60a9 (diff)
Removed hardcoded pks in annotations and delete_regress tests.
Diffstat (limited to 'tests/annotations')
-rw-r--r--tests/annotations/tests.py40
1 files changed, 28 insertions, 12 deletions
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!