Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.0.X] Fixed #11392 -- Enforced a predictable result order for a cou…

…ple of test cases. Thanks to Nathan Auch for the report and patch.

Merge of r11119 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c4e240fae3972f4848fe663a171754b0a309dddc 1 parent 74b6316
@freakboy3742 freakboy3742 authored
View
3  tests/modeltests/transactions/models.py
@@ -14,6 +14,9 @@ class Reporter(models.Model):
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)
View
3  tests/regressiontests/null_fk/models.py
@@ -22,6 +22,9 @@ class Comment(models.Model):
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
View
4 tests/regressiontests/serializers_regress/tests.py
@@ -103,7 +103,7 @@ def data_compare(testcase, pk, klass, data):
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 fk_compare(testcase, pk, klass, data):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.