From d48f530b0e286888fe99303ca58772e129a63476 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 1 Jan 2010 21:35:47 +0000 Subject: [PATCH] Fixed code duplication caused in [11857]. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12048 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/localflavor/forms.py | 7 -- tests/regressiontests/localflavor/models.py | 8 -- tests/regressiontests/localflavor/tests.py | 83 --------------------- 3 files changed, 98 deletions(-) diff --git a/tests/regressiontests/localflavor/forms.py b/tests/regressiontests/localflavor/forms.py index 49635b02fb..2dd1da6dd0 100644 --- a/tests/regressiontests/localflavor/forms.py +++ b/tests/regressiontests/localflavor/forms.py @@ -1,13 +1,6 @@ from django.forms import ModelForm from models import Place -class PlaceForm(ModelForm): - """docstring for PlaceForm""" - class Meta: - model = Place -from django.forms import ModelForm -from models import Place - class PlaceForm(ModelForm): """docstring for PlaceForm""" class Meta: diff --git a/tests/regressiontests/localflavor/models.py b/tests/regressiontests/localflavor/models.py index 079c7bd982..f74a5051d4 100644 --- a/tests/regressiontests/localflavor/models.py +++ b/tests/regressiontests/localflavor/models.py @@ -1,14 +1,6 @@ from django.db import models from django.contrib.localflavor.us.models import USStateField -class Place(models.Model): - state = USStateField(blank=True) - state_req = USStateField() - state_default = USStateField(default="CA", blank=True) - name = models.CharField(max_length=20) -from django.db import models -from django.contrib.localflavor.us.models import USStateField - class Place(models.Model): state = USStateField(blank=True) state_req = USStateField() diff --git a/tests/regressiontests/localflavor/tests.py b/tests/regressiontests/localflavor/tests.py index 61e0e5b5e6..0ea3c52568 100644 --- a/tests/regressiontests/localflavor/tests.py +++ b/tests/regressiontests/localflavor/tests.py @@ -2,89 +2,6 @@ from django.test import TestCase from models import Place from forms import PlaceForm -class USLocalflavorTests(TestCase): - def setUp(self): - self.form = PlaceForm({'state':'GA', 'state_req':'NC', 'name':'impossible'}) - - def test_get_display_methods(self): - """Test that the get_*_display() methods are added to the model instances.""" - place = self.form.save() - self.assertEqual(place.get_state_display(), 'Georgia') - self.assertEqual(place.get_state_req_display(), 'North Carolina') - - def test_required(self): - """Test that required USStateFields throw appropriate errors.""" - form = PlaceForm({'state':'GA', 'name':'Place in GA'}) - self.assertFalse(form.is_valid()) - self.assertEqual(form.errors['state_req'], [u'This field is required.']) - - def test_field_blank_option(self): - """Test that the empty option is there.""" - state_select_html = """\ -""" - self.assertEqual(str(self.form['state']), state_select_html) -from django.test import TestCase -from models import Place -from forms import PlaceForm - class USLocalflavorTests(TestCase): def setUp(self): self.form = PlaceForm({'state':'GA', 'state_req':'NC', 'name':'impossible'})