Ticket #17415: 17415-testcase.diff
File 17415-testcase.diff, 1.4 KB (added by , 13 years ago) |
---|
-
tests/regressiontests/model_regress/tests.py
8 8 from django.utils import tzinfo 9 9 10 10 from .models import (Worker, Article, Party, Event, Department, 11 BrokenUnicodeMethod, NonAutoPK)11 BrokenUnicodeMethod, Dummy, NonAutoPK) 12 12 13 13 14 14 … … 164 164 1 165 165 ) 166 166 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) 167 175 176 168 177 class ModelValidationTest(TestCase): 169 178 def test_pk_validation(self): 170 179 one = NonAutoPK.objects.create(name="one") -
tests/regressiontests/model_regress/models.py
55 55 # object). 56 56 return 'Názov: %s' % self.name 57 57 58 class Dummy(models.Model): 59 pass 60 58 61 class NonAutoPK(models.Model): 59 62 name = models.CharField(max_length=10, primary_key=True)