Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Corrected an aggregation test failure under PostgreSQL, introduced by…

… r15223. Thanks to Alex for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15230 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 964cf1be866e7db410d8a5b08d4d83c620a697cd 1 parent 1ebd686
Russell Keith-Magee authored January 17, 2011
6  tests/regressiontests/aggregation_regress/tests.py
@@ -479,19 +479,19 @@ def test_values_queryset_non_conflict(self):
479 479
 
480 480
         # age is a field on Author, so it shouldn't be allowed as an aggregate.
481 481
         # But age isn't included in the ValuesQuerySet, so it is.
482  
-        results = Author.objects.values('name').annotate(age=Count('book_contact_set'))
  482
+        results = Author.objects.values('name').annotate(age=Count('book_contact_set')).order_by('name')
483 483
         self.assertEquals(len(results), 9)
484 484
         self.assertEquals(results[0]['name'], u'Adrian Holovaty')
485 485
         self.assertEquals(results[0]['age'], 1)
486 486
 
487 487
         # Same problem, but aggregating over m2m fields
488  
-        results = Author.objects.values('name').annotate(age=Avg('friends__age'))
  488
+        results = Author.objects.values('name').annotate(age=Avg('friends__age')).order_by('name')
489 489
         self.assertEquals(len(results), 9)
490 490
         self.assertEquals(results[0]['name'], u'Adrian Holovaty')
491 491
         self.assertEquals(results[0]['age'], 32.0)
492 492
 
493 493
         # Same problem, but colliding with an m2m field
494  
-        results = Author.objects.values('name').annotate(friends=Count('friends'))
  494
+        results = Author.objects.values('name').annotate(friends=Count('friends')).order_by('name')
495 495
         self.assertEquals(len(results), 9)
496 496
         self.assertEquals(results[0]['name'], u'Adrian Holovaty')
497 497
         self.assertEquals(results[0]['friends'], 2)

0 notes on commit 964cf1b

Please sign in to comment.
Something went wrong with that request. Please try again.