diff --git a/tests/modeltests/aggregation/models.py b/tests/modeltests/aggregation/models.py index f68ff3937e..e5dd138355 100644 --- a/tests/modeltests/aggregation/models.py +++ b/tests/modeltests/aggregation/models.py @@ -191,7 +191,7 @@ u'The Definitive Guide to Django: Web Development Done Right' # Calling values on a queryset that has annotations returns the output # as a dictionary ->>> [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values()] +>>> [sorted(o.items()) for o in Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values()] [[('contact_id', 1), ('id', 1), ('isbn', u'159059725'), ('mean_age', 34.5), ('name', u'The Definitive Guide to Django: Web Development Done Right'), ('pages', 447), ('price', Decimal("30...")), ('pubdate', datetime.date(2007, 12, 6)), ('publisher_id', 1), ('rating', 4.5)]] >>> Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values('pk', 'isbn', 'mean_age') @@ -203,7 +203,7 @@ u'The Definitive Guide to Django: Web Development Done Right' # An empty values() call before annotating has the same effect as an # empty values() call after annotating ->>> [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).values().annotate(mean_age=Avg('authors__age'))] +>>> [sorted(o.items()) for o in Book.objects.filter(pk=1).values().annotate(mean_age=Avg('authors__age'))] [[('contact_id', 1), ('id', 1), ('isbn', u'159059725'), ('mean_age', 34.5), ('name', u'The Definitive Guide to Django: Web Development Done Right'), ('pages', 447), ('price', Decimal("30...")), ('pubdate', datetime.date(2007, 12, 6)), ('publisher_id', 1), ('rating', 4.5)]] # Calling annotate() on a ValuesQuerySet annotates over the groups of diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py index eefa56ac2b..24e464b2f6 100644 --- a/tests/regressiontests/aggregation_regress/models.py +++ b/tests/regressiontests/aggregation_regress/models.py @@ -174,7 +174,7 @@ FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta {'number': 1132, 'select': 1132} # Regression for #10064: select_related() plays nice with aggregates ->>> sorted(Book.objects.select_related('publisher').annotate(num_authors=Count('authors')).values()[0].iteritems()) +>>> sorted(Book.objects.select_related('publisher').annotate(num_authors=Count('authors')).values()[0].items()) [('contact_id', 8), ('id', 5), ('isbn', u'013790395'), ('name', u'Artificial Intelligence: A Modern Approach'), ('num_authors', 2), ('pages', 1132), ('price', Decimal("82.8...")), ('pubdate', datetime.date(1995, 1, 15)), ('publisher_id', 3), ('rating', 4.0)] # Regression for #10010: exclude on an aggregate field is correctly negated