From 0452d4c3cce8b41e01a21977cf35341712e70e7c Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sun, 17 Jul 2011 22:22:39 +0000 Subject: [PATCH] Fixed #16480 -- Modified test added in r16522 so it doesn't use a query not supported under Oracle (`GROUP BY` a NCLOB field). Thanks Aymeric for the report. Refs #4186 git-svn-id: http://code.djangoproject.com/svn/django/trunk@16546 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/defer_regress/models.py | 10 ++++++++++ tests/regressiontests/defer_regress/tests.py | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/regressiontests/defer_regress/models.py b/tests/regressiontests/defer_regress/models.py index 1d1a2247de..73cefb130d 100644 --- a/tests/regressiontests/defer_regress/models.py +++ b/tests/regressiontests/defer_regress/models.py @@ -36,3 +36,13 @@ class ResolveThis(models.Model): class Proxy(Item): class Meta: proxy = True + +class SimpleItem(models.Model): + name = models.CharField(max_length=15) + value = models.IntegerField() + + def __unicode__(self): + return self.name + +class Feature(models.Model): + item = models.ForeignKey(SimpleItem) diff --git a/tests/regressiontests/defer_regress/tests.py b/tests/regressiontests/defer_regress/tests.py index 8bd9579ff4..14fa13395d 100644 --- a/tests/regressiontests/defer_regress/tests.py +++ b/tests/regressiontests/defer_regress/tests.py @@ -6,7 +6,8 @@ from django.db.models import Count from django.db.models.loading import cache from django.test import TestCase -from models import ResolveThis, Item, RelatedItem, Child, Leaf, Proxy +from models import (ResolveThis, Item, RelatedItem, Child, Leaf, Proxy, + SimpleItem, Feature) class DeferRegressionTest(TestCase): @@ -108,11 +109,13 @@ class DeferRegressionTest(TestCase): self.assertEqual( klasses, [ Child, + Feature, Item, Leaf, Proxy, RelatedItem, ResolveThis, + SimpleItem, ] ) @@ -128,6 +131,7 @@ class DeferRegressionTest(TestCase): klasses, [ "Child", "Child_Deferred_value", + "Feature", "Item", "Item_Deferred_name", "Item_Deferred_name_other_value_text", @@ -144,12 +148,13 @@ class DeferRegressionTest(TestCase): "RelatedItem_Deferred_", "RelatedItem_Deferred_item_id", "ResolveThis", + "SimpleItem", ] ) # Regression for #16409 - make sure defer() and only() work with annotate() - self.assertIsInstance(list(Item.objects.annotate(Count('relateditem')).defer('name')), list) - self.assertIsInstance(list(Item.objects.annotate(Count('relateditem')).only('name')), list) + self.assertIsInstance(list(SimpleItem.objects.annotate(Count('feature')).defer('name')), list) + self.assertIsInstance(list(SimpleItem.objects.annotate(Count('feature')).only('name')), list) def test_only_and_defer_usage_on_proxy_models(self): # Regression for #15790 - only() broken for proxy models