mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #7366 -- Modified a few expected test outputs to remove the dependency 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
This commit is contained in:
@@ -401,8 +401,9 @@ True
|
||||
|
||||
# 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
|
||||
|
||||
@@ -110,8 +110,9 @@ __test__ = {'API_TESTS':"""
|
||||
>>> 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>}
|
||||
|
||||
Reference in New Issue
Block a user