From 8fe03865f7d7059e051976d1f9336f2ff83a30c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Tue, 14 Aug 2012 15:24:43 +0300 Subject: [PATCH] [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. --- tests/regressiontests/queries/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py index 1582993dfc..7eae302c51 100644 --- a/tests/regressiontests/queries/tests.py +++ b/tests/regressiontests/queries/tests.py @@ -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):