From cd847db17fbb578c580c54ac41dcb899ef3b9cb0 Mon Sep 17 00:00:00 2001 From: Ian Kelly Date: Wed, 1 Dec 2010 21:35:54 +0000 Subject: [PATCH] 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 --- tests/modeltests/select_related/tests.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/modeltests/select_related/tests.py b/tests/modeltests/select_related/tests.py index 301ce93b39c..1355c53221d 100644 --- a/tests/modeltests/select_related/tests.py +++ b/tests/modeltests/select_related/tests.py @@ -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):