#NEWLINE# def test_fieldlist_with_initial_delete( self ) : #NEWLINE# #INDENT# 'Fieldlist element deletion' #NEWLINE# class _Form ( Form ) : #NEWLINE# #INDENT# fields = [ FieldList ( 'list' , field = Field ( 'number' , convs . Int ( ) ) ) ] #NEWLINE# #UNINDENT# env = AppEnvironment . create ( ) #NEWLINE# form = _Form ( env , initial = { #NEWLINE# #INDENT# 'list' : [ 1 , 2 , 3 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( form . raw_data , MultiDict ( ( ( 'list-indices' , '1' ) , ( 'list-indices' , '2' ) , ( 'list-indices' , '3' ) ) , ** { #NEWLINE# #INDENT# 'list.1' : '1' , #NEWLINE# 'list.2' : '2' , #NEWLINE# 'list.3' : '3' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertEqual ( form . python_data , { #NEWLINE# #INDENT# 'list' : [ 1 , 2 , 3 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assert_ ( form . accept ( MultiDict ( ( ( 'list-indices' , '1' ) , ( 'list-indices' , '3' ) ) , ** { #NEWLINE# #INDENT# 'list.1' : '1' , #NEWLINE# 'list.3' : '3' , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# self . assertEqual ( form . python_data , { #NEWLINE# #INDENT# 'list' : [ 1 , 3 ] , #NEWLINE# #UNINDENT# } )