Ticket #17415: 17415-testcase.diff

File 17415-testcase.diff, 1.4 KB (added by Aymeric Augustin, 13 years ago)
  • tests/regressiontests/model_regress/tests.py

     
    88from django.utils import tzinfo
    99
    1010from .models import (Worker, Article, Party, Event, Department,
    11     BrokenUnicodeMethod, NonAutoPK)
     11    BrokenUnicodeMethod, Dummy, NonAutoPK)
    1212
    1313
    1414
     
    164164            1
    165165        )
    166166
     167    def test_forced_primary_key(self):
     168        # Regression for #17415
     169        d1 = Dummy(pk=1)
     170        d1.save()
     171        d2 = Dummy()
     172        d2.save()
     173        # The previous line used to raise IntegrityError under PostgreSQL
     174        self.assertIsInstance(d2.pk, int)
    167175
     176
    168177class ModelValidationTest(TestCase):
    169178    def test_pk_validation(self):
    170179        one = NonAutoPK.objects.create(name="one")
  • tests/regressiontests/model_regress/models.py

     
    5555        # object).
    5656        return 'Názov: %s' % self.name
    5757
     58class Dummy(models.Model):
     59    pass
     60
    5861class NonAutoPK(models.Model):
    5962    name = models.CharField(max_length=10, primary_key=True)
Back to Top