diff options
author | Shai Berger <shai@platonix.com> | 2013-11-25 16:12:43 +0200 |
---|---|---|
committer | Shai Berger <shai@platonix.com> | 2013-11-25 16:16:04 +0200 |
commit | 3411af3cd195ef79f3320ee9b2ab261e9ee5a3f5 (patch) | |
tree | b32d4b862facbdd85bda7a5ab89e30d62e64e9f0 /tests/generic_relations_regress | |
parent | 70e61310d690fab109c5298e41783db61306f831 (diff) | |
download | django-3411af3cd195ef79f3320ee9b2ab261e9ee5a3f5.tar.gz |
Fixed #21403: Corrected test code
A test for annotations incorrectly assumed that the first instance
(in the test) of a model using AutoField for PK will always get pk=1.
The test was changed to compare against actual instance id instead.
Diffstat (limited to 'tests/generic_relations_regress')
-rw-r--r-- | tests/generic_relations_regress/tests.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py index 6e6ada5872..eaa8a743bd 100644 --- a/tests/generic_relations_regress/tests.py +++ b/tests/generic_relations_regress/tests.py @@ -222,10 +222,10 @@ class GenericRelationTests(TestCase): Link.objects.create(content_object=b) qs = HasLinkThing.objects.annotate(Sum('links')) # If content_type restriction isn't in the query's join condition, - # then wrong results are produced here as b will also match (it has - # same pk). + # then wrong results are produced here as the link to b will also match + # (b and hs1 have equal pks). self.assertEqual(qs.count(), 1) - self.assertEqual(qs[0].links__sum, 1) + self.assertEqual(qs[0].links__sum, l.id) l.delete() # Now if we don't have proper left join, we will not produce any # results at all here. |