Skip to content

Commit

Permalink
Removed US localflavor-specific tests from core
Browse files Browse the repository at this point in the history
Also fixes #9045.
  • Loading branch information
claudep committed Dec 8, 2012
1 parent d5ed81c commit 8248d14
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 48 deletions.
3 changes: 0 additions & 3 deletions docs/topics/forms/modelforms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ Model field Form field

``NullBooleanField`` ``CharField``

``PhoneNumberField`` ``USPhoneNumberField``
(from ``django.contrib.localflavor.us``)

``PositiveIntegerField`` ``IntegerField``

``PositiveSmallIntegerField`` ``IntegerField``
Expand Down
9 changes: 0 additions & 9 deletions tests/modeltests/model_forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ class WriterProfile(models.Model):
def __str__(self):
return "%s is %s" % (self.writer, self.age)

from django.contrib.localflavor.us.models import PhoneNumberField
@python_2_unicode_compatible
class PhoneNumber(models.Model):
phone = PhoneNumberField()
description = models.CharField(max_length=20)

def __str__(self):
return self.phone

@python_2_unicode_compatible
class TextFile(models.Model):
description = models.CharField(max_length=20)
Expand Down
14 changes: 2 additions & 12 deletions tests/modeltests/model_forms/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .models import (Article, ArticleStatus, BetterWriter, BigInt, Book,
Category, CommaSeparatedInteger, CustomFieldForExclusionModel, DerivedBook,
DerivedPost, ExplicitPK, FlexibleDatePost, ImprovedArticle,
ImprovedArticleWithParentLink, Inventory, PhoneNumber, Post, Price,
ImprovedArticleWithParentLink, Inventory, Post, Price,
Product, TextFile, Writer, WriterProfile, test_images)

if test_images:
Expand Down Expand Up @@ -148,10 +148,6 @@ class WriterProfileForm(forms.ModelForm):
class Meta:
model = WriterProfile

class PhoneNumberForm(forms.ModelForm):
class Meta:
model = PhoneNumber

class TextFileForm(forms.ModelForm):
class Meta:
model = TextFile
Expand All @@ -167,7 +163,7 @@ class Media:
'all': ('/some/form/css',)
}
class Meta:
model = PhoneNumber
model = TextFile

class CommaSeparatedIntegerForm(forms.ModelForm):
class Meta:
Expand Down Expand Up @@ -1149,12 +1145,6 @@ def test_with_data(self):
</select></p>
<p><label for="id_age">Age:</label> <input type="text" name="age" value="65" id="id_age" /></p>''' % (w_woodward.pk, w_bernstein.pk, bw.pk, w_royko.pk))

def test_phone_number_field(self):
f = PhoneNumberForm({'phone': '(312) 555-1212', 'description': 'Assistance'})
self.assertEqual(f.is_valid(), True)
self.assertEqual(f.cleaned_data['phone'], '312-555-1212')
self.assertEqual(f.cleaned_data['description'], 'Assistance')

def test_file_field(self):
# Test conditions when files is either not given or empty.

Expand Down
13 changes: 0 additions & 13 deletions tests/regressiontests/serializers_regress/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.localflavor.us.models import USStateField, PhoneNumberField

# The following classes are for testing basic data
# marshalling, including NULL values, where allowed.
Expand Down Expand Up @@ -58,9 +57,6 @@ class GenericIPAddressData(models.Model):
class NullBooleanData(models.Model):
data = models.NullBooleanField(null=True)

class PhoneData(models.Model):
data = PhoneNumberField(null=True)

class PositiveIntegerData(models.Model):
data = models.PositiveIntegerField(null=True)

Expand All @@ -79,9 +75,6 @@ class TextData(models.Model):
class TimeData(models.Model):
data = models.TimeField(null=True)

class USStateData(models.Model):
data = USStateField(null=True)

class Tag(models.Model):
"""A tag on an item."""
data = models.SlugField()
Expand Down Expand Up @@ -212,9 +205,6 @@ class GenericIPAddressPKData(models.Model):
# class NullBooleanPKData(models.Model):
# data = models.NullBooleanField(primary_key=True)

class PhonePKData(models.Model):
data = PhoneNumberField(primary_key=True)

class PositiveIntegerPKData(models.Model):
data = models.PositiveIntegerField(primary_key=True)

Expand All @@ -233,9 +223,6 @@ class SmallPKData(models.Model):
# class TimePKData(models.Model):
# data = models.TimeField(primary_key=True)

class USStatePKData(models.Model):
data = USStateField(primary_key=True)

class ComplexModel(models.Model):
field1 = models.CharField(max_length=10)
field2 = models.CharField(max_length=10)
Expand Down
15 changes: 4 additions & 11 deletions tests/regressiontests/serializers_regress/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

from .models import (BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
GenericIPAddressData, NullBooleanData, PhoneData, PositiveIntegerData,
GenericIPAddressData, NullBooleanData, PositiveIntegerData,
PositiveSmallIntegerData, SlugData, SmallData, TextData, TimeData,
USStateData, GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
FKSelfData, M2MSelfData, FKDataToField, FKDataToO2O, M2MIntermediateData,
Intermediate, BooleanPKData, CharPKData, EmailPKData, FilePathPKData,
DecimalPKData, FloatPKData, IntegerPKData, IPAddressPKData,
GenericIPAddressPKData, PhonePKData, PositiveIntegerPKData,
PositiveSmallIntegerPKData, SlugPKData, SmallPKData, USStatePKData,
GenericIPAddressPKData, PositiveIntegerPKData,
PositiveSmallIntegerPKData, SlugPKData, SmallPKData,
AutoNowDateTimeData, ModifyingSaveData, InheritAbstractModel, BaseModel,
ExplicitInheritBaseModel, InheritBaseModel, ProxyBaseModel,
ProxyProxyBaseModel, BigIntegerData, LengthModel, Tag, ComplexModel,
Expand Down Expand Up @@ -218,8 +218,6 @@ def inherited_compare(testcase, pk, klass, data):
(data_obj, 100, NullBooleanData, True),
(data_obj, 101, NullBooleanData, False),
(data_obj, 102, NullBooleanData, None),
(data_obj, 110, PhoneData, "212-634-5789"),
(data_obj, 111, PhoneData, None),
(data_obj, 120, PositiveIntegerData, 123456789),
(data_obj, 121, PositiveIntegerData, None),
(data_obj, 130, PositiveSmallIntegerData, 12),
Expand All @@ -239,9 +237,6 @@ def inherited_compare(testcase, pk, klass, data):
(data_obj, 162, TextData, None),
(data_obj, 170, TimeData, datetime.time(10,42,37)),
(data_obj, 171, TimeData, None),
(data_obj, 180, USStateData, "MA"),
(data_obj, 181, USStateData, None),
(data_obj, 182, USStateData, ""),

(generic_obj, 200, GenericData, ['Generic Object 1', 'tag1', 'tag2']),
(generic_obj, 201, GenericData, ['Generic Object 2', 'tag2', 'tag3']),
Expand Down Expand Up @@ -320,7 +315,6 @@ def inherited_compare(testcase, pk, klass, data):
(pk_obj, 695, GenericIPAddressPKData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
# (pk_obj, 700, NullBooleanPKData, True),
# (pk_obj, 701, NullBooleanPKData, False),
(pk_obj, 710, PhonePKData, "212-634-5789"),
(pk_obj, 720, PositiveIntegerPKData, 123456789),
(pk_obj, 730, PositiveSmallIntegerPKData, 12),
(pk_obj, 740, SlugPKData, "this-is-a-slug"),
Expand All @@ -332,7 +326,6 @@ def inherited_compare(testcase, pk, klass, data):
# Several of them.
# The end."""),
# (pk_obj, 770, TimePKData, datetime.time(10,42,37)),
(pk_obj, 780, USStatePKData, "MA"),
# (pk_obj, 790, XMLPKData, "<foo></foo>"),

(data_obj, 800, AutoNowDateTimeData, datetime.datetime(2006,6,16,10,42,37)),
Expand Down

0 comments on commit 8248d14

Please sign in to comment.