Testing Django Forms that Contain a MultipleChoiceField

It’s pretty simple. Just return a Python list of values:

data = {
    'a_field': u'1',
    'a_multiple_choice_field': ['achoice', 'another_choice']
response = client.post(view_url, data)

Django TestCase: Inspecting Errors

I use PyCharm for all my Django projects. With PyCharm it is easy to set break points and inspect variables, although sometimes it is difficult to know what variables to look at. This is the case when trying to figure out form errors when running Django TestCase.

If the variable “response” contains the values returned by a post, then errors are at:


where errors is a dict.