summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-12-19 13:43:16 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-12-19 13:43:16 +0000
commitf47cfe12ae7354eb1bbcc9fe0c58f84778501ff4 (patch)
tree2207f3c7a45436b50139a5cc5754787173a1c6a4
parent7292cc8d60f9e993c26755456468cfd4cd8eb03e (diff)
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
-rw-r--r--tests/regressiontests/queries/models.py9
1 files 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')