how to view WTForms validation errors?

flask, python, testing, unit-testing, wtforms

Solution

Use `form.errors`:

`errors`

A dict containing a list of errors for each field. Empty if the form hasn’t been validated, or there were no errors.

Problem

I am writing some basic tests and have a test failing. ``` def test_new_user_registration(self): self.client.get('/user/register') form = RegistrationForm( email=u'crow@crow.com', first_name=u'Alex', last_name=u'Frazer', username=u'crow', password=u'fake_password', confirm_password=u'fake_password' ) self.assertTrue(form.validate()) ``` The assertion error is failing on `form.validate()`, but how can I view what the validation errors are?

Original source