Permalink
View
2 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
View
8 tests/modeltests/generic_relations/tests.py
@@ -88,8 +88,8 @@ def test_generic_relations(self):
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 @@ def test_generic_relations(self):
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,16 +114,16 @@ def test_generic_relations(self):
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)
],
comp_func
)
# 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(), [
View
8 tests/regressiontests/test_utils/python_25.py
@@ -11,13 +11,11 @@ def test_simple(self):
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:

0 comments on commit cd63ce0

Please sign in to comment.