From 6a9a9e50f233b3ba4af13bf2dc664dfa3b12038d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Mon, 20 Jul 2015 13:35:24 +0300 Subject: [PATCH] Fixed test with incorrect assumption about pk values. The test results were dependent on the order in which the tests were run. --- tests/queries/tests.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 36579937f4..26b9b1eb32 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -3524,8 +3524,15 @@ class RelatedLookupTypeTests(TestCase): """ #23396 - Ensure ValueQuerySets are not checked for compatibility with the lookup field """ + # Make sure the num and objecta field values match. + ob = ObjectB.objects.get(name='ob') + ob.num = ob.objecta.pk + ob.save() + pob = ObjectB.objects.get(name='pob') + pob.num = pob.objecta.pk + pob.save() self.assertQuerysetEqual(ObjectB.objects.filter( - objecta__in=ObjectB.objects.all().values_list('pk') + objecta__in=ObjectB.objects.all().values_list('num') ).order_by('pk'), ['', ''])