Ticket #6818: 6818-failing-tests-against-8818.diff

File 6818-failing-tests-against-8818.diff, 1.9 KB (added by Honza Král, 16 years ago)

tests that fail for the current SVN version

  • tests/modeltests/generic_relations/models.py

    commit cc3381358bac66f15cc915dc926b535ee32c3240
    Author: Honza Král <Honza.Kral@gmail.com>
    Date:   Tue Sep 2 00:09:05 2008 +0200
    
        Added failing tests for generic relation delete()
    
    diff --git a/tests/modeltests/generic_relations/models.py b/tests/modeltests/generic_relations/models.py
    index 2f36e26..5a73ab4 100644
    a b class Comparison(models.Model):  
    4545    def __unicode__(self):
    4646        return u"%s is %s than %s" % (self.first_obj, self.comparative, self.other_obj)
    4747
     48class SomeModel(models.Model):
     49    tag = models.ForeignKey(TaggedItem)
     50    def __unicode__(self):
     51        return unicode(self.tag)
     52
    4853class Animal(models.Model):
    4954    common_name = models.CharField(max_length=150)
    5055    latin_name = models.CharField(max_length=150)
    __test__ = {'API_TESTS':"""  
    144149>>> [(t.tag, t.content_type, t.object_id) for t in TaggedItem.objects.all()]
    145150[(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'hairy', <ContentType: animal>, 2), (u'salty', <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1), (u'yellow', <ContentType: animal>, 2)]
    146151
     152>>> ctype = ContentType.objects.get_for_model(lion)
     153>>> ti = TaggedItem.objects.get(content_type__id=ctype.pk, object_id=lion.pk, tag='hairy')
     154>>> sm = SomeModel( tag=ti )
     155>>> sm.save()
     156>>> sm.tag
     157<TaggedItem: hairy>
    147158>>> lion.delete()
    148159>>> [(t.tag, t.content_type, t.object_id) for t in TaggedItem.objects.all()]
    149160[(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'salty', <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1)]
     161>>> SomeModel.objects.all()
     162[]
    150163
    151164# If Generic Relation is not explicitly defined, any related objects
    152165# remain after deletion of the source object.
Back to Top