summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-10-17 01:49:36 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-10-17 01:49:36 +0000
commitcd63ce077df6568a4c4420f1f28d27c93aae236f (patch)
tree8da0b99f011b73a5381fb770eb232d33f722877e
parentd931f43b7081b88ae47adf32d32ccc005c1b8e43 (diff)
Corrected a suite of test failures when running under postgres.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/modeltests/generic_relations/models.py2
-rw-r--r--tests/modeltests/generic_relations/tests.py8
-rw-r--r--tests/regressiontests/test_utils/python_25.py8
3 files changed, 8 insertions, 10 deletions
diff --git a/tests/modeltests/generic_relations/models.py b/tests/modeltests/generic_relations/models.py
index 6161f9ebea..18b77a355e 100644
--- a/tests/modeltests/generic_relations/models.py
+++ b/tests/modeltests/generic_relations/models.py
@@ -23,7 +23,7 @@ class TaggedItem(models.Model):
content_object = generic.GenericForeignKey()
class Meta:
- ordering = ["tag", "-object_id"]
+ ordering = ["tag", "content_type__name"]
def __unicode__(self):
return self.tag
diff --git a/tests/modeltests/generic_relations/tests.py b/tests/modeltests/generic_relations/tests.py
index e26db55ade..3d253010ff 100644
--- a/tests/modeltests/generic_relations/tests.py
+++ b/tests/modeltests/generic_relations/tests.py
@@ -88,8 +88,8 @@ class GenericRelationsTests(TestCase):
self.assertQuerysetEqual(TaggedItem.objects.all(), [
(u'clearish', Mineral, quartz.pk),
- (u'fatty', Vegetable, bacon.pk),
(u'fatty', Animal, platypus.pk),
+ (u'fatty', Vegetable, bacon.pk),
(u'hairy', Animal, lion.pk),
(u'salty', Vegetable, bacon.pk),
(u'shiny', Animal, platypus.pk),
@@ -100,8 +100,8 @@ class GenericRelationsTests(TestCase):
lion.delete()
self.assertQuerysetEqual(TaggedItem.objects.all(), [
(u'clearish', Mineral, quartz.pk),
- (u'fatty', Vegetable, bacon.pk),
(u'fatty', Animal, platypus.pk),
+ (u'fatty', Vegetable, bacon.pk),
(u'salty', Vegetable, bacon.pk),
(u'shiny', Animal, platypus.pk)
],
@@ -114,8 +114,8 @@ class GenericRelationsTests(TestCase):
quartz.delete()
self.assertQuerysetEqual(TaggedItem.objects.all(), [
(u'clearish', Mineral, quartz_pk),
- (u'fatty', Vegetable, bacon.pk),
(u'fatty', Animal, platypus.pk),
+ (u'fatty', Vegetable, bacon.pk),
(u'salty', Vegetable, bacon.pk),
(u'shiny', Animal, platypus.pk)
],
@@ -123,7 +123,7 @@ class GenericRelationsTests(TestCase):
)
# If you delete a tag, the objects using the tag are unaffected
# (other than losing a tag)
- tag = TaggedItem.objects.get(id=1)
+ tag = TaggedItem.objects.order_by("id")[0]
tag.delete()
self.assertQuerysetEqual(bacon.tags.all(), ["<TaggedItem: salty>"])
self.assertQuerysetEqual(TaggedItem.objects.all(), [
diff --git a/tests/regressiontests/test_utils/python_25.py b/tests/regressiontests/test_utils/python_25.py
index a1e8a94d1e..c28ae68c2e 100644
--- a/tests/regressiontests/test_utils/python_25.py
+++ b/tests/regressiontests/test_utils/python_25.py
@@ -11,13 +11,11 @@ class AssertNumQueriesTests(TestCase):
pass
with self.assertNumQueries(1):
- # Guy who wrote Linux
- Person.objects.create(name="Linus Torvalds")
+ Person.objects.count()
with self.assertNumQueries(2):
- # Guy who owns the bagel place I like
- Person.objects.create(name="Uncle Ricky")
- self.assertEqual(Person.objects.count(), 2)
+ Person.objects.count()
+ Person.objects.count()
def test_failure(self):
with self.assertRaises(AssertionError) as exc_info: