Ticket #3077: 3077-test.diff

File 3077-test.diff, 1.5 KB (added by Andy Durdin, 16 years ago)

Regression test

  • tests/regressiontests/model_regress/models.py

     
    5858        # object).
    5959        return 'Názov: %s' % self.name
    6060
     61class OneToOneChainA(models.Model):
     62    key = models.CharField(max_length=10, primary_key=True)
    6163
     64class OneToOneChainB(models.Model):
     65    a = models.OneToOneField(OneToOneChainA, primary_key=True)
     66
     67class OneToOneChainC(models.Model):
     68    a = models.ForeignKey(OneToOneChainA)
     69    b = models.OneToOneField(OneToOneChainB, primary_key=True)
     70
     71class OneToOneChainD(models.Model):
     72    a = models.ForeignKey(OneToOneChainA)
     73    b = models.ForeignKey(OneToOneChainB)
     74    c = models.OneToOneField(OneToOneChainC, primary_key=True)
     75
    6276__test__ = {'API_TESTS': """
    6377(NOTE: Part of the regression test here is merely parsing the model
    6478declaration. The verbose_name, in particular, did not always work.)
     
    147161>>> BrokenUnicodeMethod.objects.all()
    148162[<BrokenUnicodeMethod: [Bad Unicode data]>]
    149163
     164# Regression test for #3077
     165>>> OneToOneChainB._meta.pk.db_type() == OneToOneChainA._meta.pk.db_type()
     166True
     167>>> OneToOneChainC._meta.pk.db_type() == OneToOneChainA._meta.pk.db_type()
     168True
     169>>> OneToOneChainD._meta.pk.db_type() == OneToOneChainA._meta.pk.db_type()
     170True
     171
    150172"""}
    151173
    152174if settings.DATABASE_ENGINE not in ("mysql", "oracle"):
Back to Top