Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed result ordering assumptions in the select_related tests.

Backport of r14762 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14763 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1155b493bc37ea37a31ff2a0da2be253504a59f8 1 parent e86e303
@ikelly ikelly authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 tests/modeltests/select_related/tests.py
View
20 tests/modeltests/select_related/tests.py
@@ -68,11 +68,11 @@ def test_list_without_select_related(self):
"""
world = Species.objects.all()
families = [o.genus.family.name for o in world]
- self.assertEqual(families, [
+ self.assertEqual(sorted(families), [
+ 'Amanitacae',
'Drosophilidae',
- 'Hominidae',
'Fabaceae',
- 'Amanitacae',
+ 'Hominidae',
])
self.assertEqual(len(db.connection.queries), 9)
@@ -83,11 +83,11 @@ def test_list_with_select_related(self):
"""
world = Species.objects.all().select_related()
families = [o.genus.family.name for o in world]
- self.assertEqual(families, [
+ self.assertEqual(sorted(families), [
+ 'Amanitacae',
'Drosophilidae',
- 'Hominidae',
'Fabaceae',
- 'Amanitacae',
+ 'Hominidae',
])
self.assertEqual(len(db.connection.queries), 1)
@@ -118,8 +118,8 @@ def test_list_with_depth(self):
"""
world = Species.objects.all().select_related(depth=2)
orders = [o.genus.family.order.name for o in world]
- self.assertEqual(orders,
- ['Diptera', 'Primates', 'Fabales', 'Agaricales'])
+ self.assertEqual(sorted(orders),
+ ['Agaricales', 'Diptera', 'Fabales', 'Primates'])
self.assertEqual(len(db.connection.queries), 5)
def test_select_related_with_extra(self):
@@ -138,8 +138,8 @@ def test_certain_fields(self):
"""
world = Species.objects.select_related('genus__family')
families = [o.genus.family.name for o in world]
- self.assertEqual(families,
- ['Drosophilidae', 'Hominidae', 'Fabaceae', 'Amanitacae'])
+ self.assertEqual(sorted(families),
+ ['Amanitacae', 'Drosophilidae', 'Fabaceae', 'Hominidae'])
self.assertEqual(len(db.connection.queries), 1)
def test_more_certain_fields(self):
Please sign in to comment.
Something went wrong with that request. Please try again.