Author: russellm
Date: 2009-06-29 07:29:48 -0500 (Mon, 29 Jun 2009)
New Revision: 11119

Modified:
   django/trunk/tests/modeltests/transactions/models.py
   django/trunk/tests/regressiontests/null_fk/models.py
   django/trunk/tests/regressiontests/serializers_regress/tests.py
Log:
Fixed #11392 -- Enforced a predictable result order for a couple of test cases. 
Thanks to Nathan Auch for the report and patch.

Modified: django/trunk/tests/modeltests/transactions/models.py
===================================================================
--- django/trunk/tests/modeltests/transactions/models.py        2009-06-26 
18:16:18 UTC (rev 11118)
+++ django/trunk/tests/modeltests/transactions/models.py        2009-06-29 
12:29:48 UTC (rev 11119)
@@ -14,6 +14,9 @@
     last_name = models.CharField(max_length=30)
     email = models.EmailField()
 
+    class Meta:
+        ordering = ('first_name', 'last_name')
+
     def __unicode__(self):
         return u"%s %s" % (self.first_name, self.last_name)
 

Modified: django/trunk/tests/regressiontests/null_fk/models.py
===================================================================
--- django/trunk/tests/regressiontests/null_fk/models.py        2009-06-26 
18:16:18 UTC (rev 11118)
+++ django/trunk/tests/regressiontests/null_fk/models.py        2009-06-29 
12:29:48 UTC (rev 11119)
@@ -22,6 +22,9 @@
     post = models.ForeignKey(Post, null=True)
     comment_text = models.CharField(max_length=250)
 
+    class Meta:
+        ordering = ('comment_text',)
+
     def __unicode__(self):
         return self.comment_text
 

Modified: django/trunk/tests/regressiontests/serializers_regress/tests.py
===================================================================
--- django/trunk/tests/regressiontests/serializers_regress/tests.py     
2009-06-26 18:16:18 UTC (rev 11118)
+++ django/trunk/tests/regressiontests/serializers_regress/tests.py     
2009-06-29 12:29:48 UTC (rev 11119)
@@ -103,7 +103,7 @@
 def generic_compare(testcase, pk, klass, data):
     instance = klass.objects.get(id=pk)
     testcase.assertEqual(data[0], instance.data)
-    testcase.assertEqual(data[1:], [t.data for t in instance.tags.all()])
+    testcase.assertEqual(data[1:], [t.data for t in 
instance.tags.order_by('id')])
 
 def fk_compare(testcase, pk, klass, data):
     instance = klass.objects.get(id=pk)
@@ -111,7 +111,7 @@
 
 def m2m_compare(testcase, pk, klass, data):
     instance = klass.objects.get(id=pk)
-    testcase.assertEqual(data, [obj.id for obj in instance.data.all()])
+    testcase.assertEqual(data, [obj.id for obj in 
instance.data.order_by('id')])
 
 def im2m_compare(testcase, pk, klass, data):
     instance = klass.objects.get(id=pk)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to