Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #7366 -- Modified a few expected test outputs to remove the dep…

…endency on dictionary ordering. Thanks for the patch, Leo Soto.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7575 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ed1c21171c78c719d4218c222d5c68bf1dbcccec 1 parent 1452d46
@freakboy3742 freakboy3742 authored
View
5 tests/modeltests/basic/models.py
@@ -401,8 +401,9 @@ def __unicode__(self):
# The 'select' argument to extra() supports names with dashes in them, as long
# as you use values().
->>> Article.objects.filter(pub_date__year=2008).extra(select={'dashed-value': '1'}).values('headline', 'dashed-value')
-[{'headline': u'Article 11', 'dashed-value': 1}, {'headline': u'Article 12', 'dashed-value': 1}]
+>>> dicts = Article.objects.filter(pub_date__year=2008).extra(select={'dashed-value': '1'}).values('headline', 'dashed-value')
+>>> [sorted(d.items()) for d in dicts]
+[[('dashed-value', 1), ('headline', u'Article 11')], [('dashed-value', 1), ('headline', u'Article 12')]]
# If you use 'select' with extra() and names containing dashes on a query
# that's *not* a values() query, those extra 'select' values will silently be
View
5 tests/modeltests/or_lookups/models.py
@@ -110,8 +110,9 @@ def __unicode__(self):
>>> Article.objects.filter(Q(headline__startswith='Hello') | Q(headline__contains='bye')).count()
3
->>> list(Article.objects.filter(Q(headline__startswith='Hello'), Q(headline__contains='bye')).values())
-[{'headline': u'Hello and goodbye', 'pub_date': datetime.datetime(2005, 11, 29, 0, 0), 'id': 3}]
+>>> dicts = list(Article.objects.filter(Q(headline__startswith='Hello'), Q(headline__contains='bye')).values())
+>>> [sorted(d.items()) for d in dicts]
+[[('headline', u'Hello and goodbye'), ('id', 3), ('pub_date', datetime.datetime(2005, 11, 29, 0, 0))]]
>>> Article.objects.filter(Q(headline__startswith='Hello')).in_bulk([1,2])
{1: <Article: Hello>}
View
20 tests/regressiontests/defaultfilters/tests.py
@@ -226,15 +226,17 @@
>>> striptags(u'some <b>html</b> with <script>alert("You smell")</script> disallowed <img /> tags')
u'some html with alert("You smell") disallowed tags'
->>> dictsort([{'age': 23, 'name': 'Barbara-Ann'},
-... {'age': 63, 'name': 'Ra Ra Rasputin'},
-... {'name': 'Jonny B Goode', 'age': 18}], 'age')
-[{'age': 18, 'name': 'Jonny B Goode'}, {'age': 23, 'name': 'Barbara-Ann'}, {'age': 63, 'name': 'Ra Ra Rasputin'}]
-
->>> dictsortreversed([{'age': 23, 'name': 'Barbara-Ann'},
-... {'age': 63, 'name': 'Ra Ra Rasputin'},
-... {'name': 'Jonny B Goode', 'age': 18}], 'age')
-[{'age': 63, 'name': 'Ra Ra Rasputin'}, {'age': 23, 'name': 'Barbara-Ann'}, {'age': 18, 'name': 'Jonny B Goode'}]
+>>> sorted_dicts = dictsort([{'age': 23, 'name': 'Barbara-Ann'},
+... {'age': 63, 'name': 'Ra Ra Rasputin'},
+... {'name': 'Jonny B Goode', 'age': 18}], 'age')
+>>> [sorted(dict.items()) for dict in sorted_dicts]
+[[('age', 18), ('name', 'Jonny B Goode')], [('age', 23), ('name', 'Barbara-Ann')], [('age', 63), ('name', 'Ra Ra Rasputin')]]
+
+>>> sorted_dicts = dictsortreversed([{'age': 23, 'name': 'Barbara-Ann'},
+... {'age': 63, 'name': 'Ra Ra Rasputin'},
+... {'name': 'Jonny B Goode', 'age': 18}], 'age')
+>>> [sorted(dict.items()) for dict in sorted_dicts]
+[[('age', 63), ('name', 'Ra Ra Rasputin')], [('age', 23), ('name', 'Barbara-Ann')], [('age', 18), ('name', 'Jonny B Goode')]]
>>> first([0,1,2])
0
View
5 tests/regressiontests/queries/models.py
@@ -503,8 +503,9 @@ def __unicode__(self):
# Despite having some extra aliases in the query, we can still omit them in a
# values() query.
->>> qs.values('id', 'rank').order_by('id')
-[{'id': 1, 'rank': 2}, {'id': 2, 'rank': 1}, {'id': 3, 'rank': 3}]
+>>> dicts = qs.values('id', 'rank').order_by('id')
+>>> [sorted(d.items()) for d in dicts]
+[[('id', 1), ('rank', 2)], [('id', 2), ('rank', 1)], [('id', 3), ('rank', 3)]]
Bugs #2874, #3002
>>> qs = Item.objects.select_related().order_by('note__note', 'name')
Please sign in to comment.
Something went wrong with that request. Please try again.