Moved declaration of test form inside the relevant test for clarity.

This commit is contained in:
Loïc Bistuer 2016-04-22 07:23:09 +07:00
parent a885bca1df
commit 6f5fcfc6d2
1 changed files with 28 additions and 30 deletions

View File

@ -8,7 +8,9 @@ from django.core import validators
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
class UserForm(forms.Form): class TestFieldWithValidators(TestCase):
def test_all_errors_get_reported(self):
class UserForm(forms.Form):
full_name = forms.CharField( full_name = forms.CharField(
max_length=50, max_length=50,
validators=[ validators=[
@ -34,12 +36,8 @@ class UserForm(forms.Form):
flags=re.IGNORECASE, flags=re.IGNORECASE,
) )
] ]
) )
class TestFieldWithValidators(TestCase):
def test_all_errors_get_reported(self):
form = UserForm({ form = UserForm({
'full_name': 'not int nor mail', 'full_name': 'not int nor mail',
'string': '2 is not correct', 'string': '2 is not correct',