#NEWLINE# def test_errors( self ) : #NEWLINE# #INDENT# form = USPlaceForm ( { #NEWLINE# #INDENT# 'state' : 'invalid' , #NEWLINE# 'state_req' : 'invalid' , #NEWLINE# 'postal_code' : 'invalid' , #NEWLINE# 'name' : 'name' , #NEWLINE# 'ssn' : 'invalid' , #NEWLINE# 'zip_code' : 'invalid' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( form . is_valid ( ) ) #NEWLINE# choice_messages = [ 'Select a valid choice. invalid is not one of the available choices.' ] #NEWLINE# self . assertEqual ( form . errors [ 'state' ] , choice_messages ) #NEWLINE# self . assertEqual ( form . errors [ 'state_req' ] , choice_messages ) #NEWLINE# self . assertEqual ( form . errors [ 'postal_code' ] , choice_messages ) #NEWLINE# self . assertEqual ( form . errors [ 'ssn' ] , [ 'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.' ] ) #NEWLINE# self . assertEqual ( form . errors [ 'zip_code' ] , [ 'Enter a zip code in the format XXXXX or XXXXX-XXXX.' ] )