Skip to content

Commit

Permalink
Make sure that all uses of max_length in the test suite use values sm…
Browse files Browse the repository at this point in the history
…aller than 255. If we use max_length > 255 the test suite can't be run on MySQL 4.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10697 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jacobian committed May 7, 2009
1 parent a59095a commit 7caf21a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions tests/modeltests/aggregation/models.py
Expand Up @@ -15,15 +15,15 @@ def __unicode__(self):
return self.name

class Publisher(models.Model):
name = models.CharField(max_length=300)
name = models.CharField(max_length=255)
num_awards = models.IntegerField()

def __unicode__(self):
return self.name

class Book(models.Model):
isbn = models.CharField(max_length=9)
name = models.CharField(max_length=300)
name = models.CharField(max_length=255)
pages = models.IntegerField()
rating = models.FloatField()
price = models.DecimalField(decimal_places=2, max_digits=6)
Expand All @@ -36,7 +36,7 @@ def __unicode__(self):
return self.name

class Store(models.Model):
name = models.CharField(max_length=300)
name = models.CharField(max_length=255)
books = models.ManyToManyField(Book)
original_opening = models.DateTimeField()
friday_night_closing = models.TimeField()
Expand Down
6 changes: 3 additions & 3 deletions tests/regressiontests/aggregation_regress/models.py
Expand Up @@ -18,15 +18,15 @@ def __unicode__(self):
return self.name

class Publisher(models.Model):
name = models.CharField(max_length=300)
name = models.CharField(max_length=255)
num_awards = models.IntegerField()

def __unicode__(self):
return self.name

class Book(models.Model):
isbn = models.CharField(max_length=9)
name = models.CharField(max_length=300)
name = models.CharField(max_length=255)
pages = models.IntegerField()
rating = models.FloatField()
price = models.DecimalField(decimal_places=2, max_digits=6)
Expand All @@ -42,7 +42,7 @@ def __unicode__(self):
return self.name

class Store(models.Model):
name = models.CharField(max_length=300)
name = models.CharField(max_length=255)
books = models.ManyToManyField(Book)
original_opening = models.DateTimeField()
friday_night_closing = models.TimeField()
Expand Down
4 changes: 2 additions & 2 deletions tests/regressiontests/forms/models.py
Expand Up @@ -16,7 +16,7 @@ class BoundaryModel(models.Model):
positive_integer = models.PositiveIntegerField(null=True, blank=True)

class Defaults(models.Model):
name = models.CharField(max_length=256, default='class default value')
name = models.CharField(max_length=255, default='class default value')
def_date = models.DateField(default = datetime.date(1980, 1, 1))
value = models.IntegerField(default=42)

Expand Down Expand Up @@ -88,7 +88,7 @@ class FileForm(django_forms.Form):
>>> from django.forms import CharField
>>> class ExcludingForm(ModelForm):
... name = CharField(max_length=256)
... name = CharField(max_length=255)
... class Meta:
... model = Defaults
... exclude = ['name']
Expand Down
8 changes: 4 additions & 4 deletions tests/regressiontests/max_lengths/models.py
Expand Up @@ -7,7 +7,7 @@ class PersonWithDefaultMaxLengths(models.Model):
avatar = models.FilePathField()

class PersonWithCustomMaxLengths(models.Model):
email = models.EmailField(max_length=384)
vcard = models.FileField(upload_to='/tmp', max_length=1024)
homepage = models.URLField(max_length=256)
avatar = models.FilePathField(max_length=512)
email = models.EmailField(max_length=250)
vcard = models.FileField(upload_to='/tmp', max_length=250)
homepage = models.URLField(max_length=250)
avatar = models.FilePathField(max_length=250)
8 changes: 4 additions & 4 deletions tests/regressiontests/max_lengths/tests.py
Expand Up @@ -14,10 +14,10 @@ def test_default_max_lengths(self):
self.verify_max_length(PersonWithDefaultMaxLengths, 'avatar', 100)

def test_custom_max_lengths(self):
self.verify_max_length(PersonWithCustomMaxLengths, 'email', 384)
self.verify_max_length(PersonWithCustomMaxLengths, 'vcard', 1024)
self.verify_max_length(PersonWithCustomMaxLengths, 'homepage', 256)
self.verify_max_length(PersonWithCustomMaxLengths, 'avatar', 512)
self.verify_max_length(PersonWithCustomMaxLengths, 'email', 250)
self.verify_max_length(PersonWithCustomMaxLengths, 'vcard', 250)
self.verify_max_length(PersonWithCustomMaxLengths, 'homepage', 250)
self.verify_max_length(PersonWithCustomMaxLengths, 'avatar', 250)

class MaxLengthORMTests(TestCase):

Expand Down

0 comments on commit 7caf21a

Please sign in to comment.