From f47cfe12ae7354eb1bbcc9fe0c58f84778501ff4 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Wed, 19 Dec 2007 13:43:16 +0000 Subject: [PATCH] queryset-refactor: Tweaked one test slightly to work around a PostgreSQL oddity. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6962 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/queries/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index 0404e9f9be..7e1c8d31ed 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -455,8 +455,13 @@ thus fail.) >>> if {'a': 1, 'b': 2}.keys() == ['a', 'b']: ... s.reverse() ... params.reverse() ->>> Item.objects.extra(select=SortedDict(s), params=params).values('a','b')[0] -{'a': u'one', 'b': u'two'} + +# This slightly odd comparison works aorund the fact that PostgreSQL will +# return 'one' and 'two' as strings, not Unicode objects. It's a side-effect of +# using constants here and not a real concern. +>>> d = Item.objects.extra(select=SortedDict(s), params=params).values('a', 'b')[0] +>>> d == {'a': u'one', 'b': u'two'} +True # Order by the number of tags attached to an item. >>> l = Item.objects.extra(select={'count': 'select count(*) from queries_item_tags where queries_item_tags.item_id = queries_item.id'}).order_by('-count')