Author: kmtracey Date: 2012-03-12 18:01:22 -0700 (Mon, 12 Mar 2012) New Revision: 17695
Modified: django/trunk/tests/modeltests/defer/tests.py Log: Refs #17876: enhanced new test to actually test underlying function, not just ensure trying to use it does not raise an exception. Thanks Przemek Lewandowski. Modified: django/trunk/tests/modeltests/defer/tests.py =================================================================== --- django/trunk/tests/modeltests/defer/tests.py 2012-03-13 00:15:43 UTC (rev 17694) +++ django/trunk/tests/modeltests/defer/tests.py 2012-03-13 01:01:22 UTC (rev 17695) @@ -146,6 +146,15 @@ obj.save() def test_defer_proxy(self): - # using select related and only should not result in Exception - for obj in ChildProxy.objects.all().select_related().only('id'): - continue + """ + Ensure select_related together with only on a proxy model behaves + as expected. See #17876. + """ + related = Secondary.objects.create(first='x1', second='x2') + ChildProxy.objects.create(name='p1', value='xx', related=related) + children = ChildProxy.objects.all().select_related().only('id', 'name') + self.assertEqual(len(children), 1) + child = children[0] + self.assert_delayed(child, 1) + self.assertEqual(child.name, 'p1') + self.assertEqual(child.value, 'xx') -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.