1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

[py3] Fixed invalid use of dict.items()

An ordering test had two problems related to dict.items() usage:
  - It assumed the order of the dict was non-randomized
  - It indexed to the dict.items() which is py3 incompatible.

I fixed the test by using dict['rank'] directly, where rank is the
column tested on the values queryset.
This commit is contained in:
Anssi Kääriäinen 2012-08-14 15:24:43 +03:00
parent 9299dc42ed
commit 8fe03865f7

View File

@ -1272,8 +1272,8 @@ class Queries5Tests(TestCase):
# them in a values() query.
dicts = qs.values('id', 'rank').order_by('id')
self.assertEqual(
[d.items()[1] for d in dicts],
[('rank', 2), ('rank', 1), ('rank', 3)]
[d['rank'] for d in dicts],
[2, 1, 3]
)
def test_ticket7256(self):