Commit 8fe03865 authored by Anssi Kääriäinen's avatar Anssi Kääriäinen
Browse files

[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.
parent 9299dc42
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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):