Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed result ordering assumptions in the select_related tests.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14762 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cd847db17fbb578c580c54ac41dcb899ef3b9cb0 1 parent 21f5dc4
Ian Kelly ikelly authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 tests/modeltests/select_related/tests.py
20 tests/modeltests/select_related/tests.py
View
@@ -64,11 +64,11 @@ def test_list_without_select_related(self):
def test():
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.assertNumQueries(9, test)
@@ -80,11 +80,11 @@ def test_list_with_select_related(self):
def test():
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.assertNumQueries(1, test)
@@ -117,8 +117,8 @@ def test_list_with_depth(self):
def test():
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.assertNumQueries(5, test)
def test_select_related_with_extra(self):
@@ -138,8 +138,8 @@ def test_certain_fields(self):
def test():
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.assertNumQueries(1, test)
def test_more_certain_fields(self):
Please sign in to comment.
Something went wrong with that request. Please try again.