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
This commit is contained in:
Ian Kelly 2010-12-01 21:35:54 +00:00
parent 21f5dc467e
commit cd847db17f
1 changed files with 12 additions and 12 deletions

View File

@ -64,11 +64,11 @@ class SelectRelatedTests(TestCase):
def test():
world = Species.objects.all()
families = [o.genus.family.name for o in world]
self.assertEqual(families, [
'Drosophilidae',
'Hominidae',
'Fabaceae',
self.assertEqual(sorted(families), [
'Amanitacae',
'Drosophilidae',
'Fabaceae',
'Hominidae',
])
self.assertNumQueries(9, test)
@ -80,11 +80,11 @@ class SelectRelatedTests(TestCase):
def test():
world = Species.objects.all().select_related()
families = [o.genus.family.name for o in world]
self.assertEqual(families, [
'Drosophilidae',
'Hominidae',
'Fabaceae',
self.assertEqual(sorted(families), [
'Amanitacae',
'Drosophilidae',
'Fabaceae',
'Hominidae',
])
self.assertNumQueries(1, test)
@ -117,8 +117,8 @@ class SelectRelatedTests(TestCase):
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 @@ class SelectRelatedTests(TestCase):
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):