-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
class TestFormExceptions(TestCase):
def test_exceptions(self):
class DatingProfile(pilo.Form):
genders = ['male', 'female', 'neutral']
name = String()
email = String()
postal_code = String(length=5)
blurb = String(max_length=100)
gender = String(choices=genders)
sexual_preferences = List(String(choices=genders))
likes = List(String())
# Two field errors
DatingProfile(
name='William Henry Cavendish III',
email='whc@example.org',
postal_code='9021', # Invalid postal code
blurb='I am a test fixture',
gender='male',
sexual_preferences=['female', 'neutral'],
# Likes parameter missing
)======================================================================
ERROR: test_exceptions (tests.test_fields.TestFormExceptions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "pilo/tests/test_fields.py", line 424, in test_exceptions
DatingProfile(**profile_params_with_two_errors)
File "pilo/pilo/fields.py", line 1581, in __init__
RaiseErrors()(*errors)
File "pilo/pilo/fields.py", line 160, in __call__
raise ex[0]
Invalid: postal_code - "9021" must have length >= 5
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels