#NEWLINE# def test_all_errors_get_reported( self ) : #NEWLINE# #INDENT# class UserForm ( forms . Form ) : #NEWLINE# #INDENT# full_name = forms . CharField ( max_length = 50 , validators = [ validators . validate_integer , validators . validate_email ] ) #NEWLINE# string = forms . CharField ( max_length = 50 , validators = [ validators . RegexValidator ( regex = '^[a-zA-Z]*$' , message = 'Letters only.' ) ] ) #NEWLINE# ignore_case_string = forms . CharField ( max_length = 50 , validators = [ validators . RegexValidator ( regex = '^[a-z]*$' , message = 'Letters only.' , flags = re . IGNORECASE ) ] ) #NEWLINE# #UNINDENT# form = UserForm ( { #NEWLINE# #INDENT# 'full_name' : 'not int nor mail' , #NEWLINE# 'string' : '2 is not correct' , #NEWLINE# 'ignore_case_string' : 'IgnORE Case strIng' , #NEWLINE# #UNINDENT# } ) #NEWLINE# with self . assertRaises ( ValidationError ) as e : #NEWLINE# #INDENT# form . fields [ 'full_name' ] . clean ( 'not int nor mail' ) #NEWLINE# #UNINDENT# self . assertEqual ( 2 , len ( e . exception . messages ) ) #NEWLINE# self . assertFalse ( form . is_valid ( ) ) #NEWLINE# self . assertEqual ( e . errors [ 'string' ] , [ 'Letters only.' ] ) #NEWLINE# self . assertEqual ( form . errors [ 'string' ] , [ 'Letters only.' ] )