Skip to content
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.
  • Loading branch information...
1 parent 9299dc4 commit 8fe03865f7d7059e051976d1f9336f2ff83a30c6 @akaariai akaariai committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 tests/regressiontests/queries/
4 tests/regressiontests/queries/
@@ -1272,8 +1272,8 @@ def test_ordering(self):
# them in a values() query.
dicts = qs.values('id', 'rank').order_by('id')
- [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):

0 comments on commit 8fe0386

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