mirror of https://github.com/django/django.git
Fixed #11392 -- Enforced a predictable result order for a couple of test cases. Thanks to Nathan Auch for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
fe2747d1e0
commit
e522e61a80
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue