Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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.
  • Loading branch information...
commit 8fe03865f7d7059e051976d1f9336f2ff83a30c6 1 parent 9299dc4
Anssi Kääriäinen authored August 14, 2012

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  tests/regressiontests/queries/tests.py
4  tests/regressiontests/queries/tests.py
@@ -1272,8 +1272,8 @@ def test_ordering(self):
1272 1272
         # them in a values() query.
1273 1273
         dicts = qs.values('id', 'rank').order_by('id')
1274 1274
         self.assertEqual(
1275  
-            [d.items()[1] for d in dicts],
1276  
-            [('rank', 2), ('rank', 1), ('rank', 3)]
  1275
+            [d['rank'] for d in dicts],
  1276
+            [2, 1, 3]
1277 1277
         )
1278 1278
 
1279 1279
     def test_ticket7256(self):

0 notes on commit 8fe0386

Please sign in to comment.
Something went wrong with that request. Please try again.