#NEWLINE# def test_validation_error( self ) : #NEWLINE# #INDENT# def validator( conv , value ) : #NEWLINE# #INDENT# raise convs . ValidationError ( by_field = { #NEWLINE# #INDENT# 'number' : 'error' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# class _Form ( Form ) : #NEWLINE# #INDENT# fields = [ FieldBlock ( 'field block' , [ Field ( 'number' , convs . Int ( ) ) ] , conv = FieldBlock . conv ( validator ) ) ] #NEWLINE# #UNINDENT# env = AppEnvironment . create ( ) #NEWLINE# form = _Form ( form ) #NEWLINE# self . assert_ ( ( not form . accept ( { #NEWLINE# #INDENT# 'number' : '4' , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# self . assertEqual ( form . python_data , { #NEWLINE# #INDENT# 'number' : None , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( form . get_field ( 'number' ) . raw_value , '4' ) #NEWLINE# self . assertEqual ( form . get_field ( 'number' ) . error , 'error' )