#NEWLINE# def test_fieldset_of_fieldsets_with_noreq( self ) : #NEWLINE# #INDENT# 'Accept of readonly fieldset of fieldsets with required=False' #NEWLINE# class _Form ( Form ) : #NEWLINE# #INDENT# fields = [ FieldSet ( 'sets' , fields = [ FieldSet ( 'set1' , fields = [ Field ( 'first' , convs . Int ( required = False ) , permissions = 'r' ) , Field ( 'second' , convs . Int ( ) ) ] ) , FieldSet ( 'set2' , fields = [ Field ( 'first' , convs . Int ( ) ) , Field ( 'second' , convs . Int ( required = False ) , permissions = 'r' ) ] ) ] ) ] #NEWLINE# #UNINDENT# env = AppEnvironment . create ( ) #NEWLINE# form = _Form ( env , initial = { #NEWLINE# #INDENT# 'sets' : { #NEWLINE# #INDENT# 'set1' : { #NEWLINE# #INDENT# 'first' : None , #NEWLINE# 'second' : 2 , #NEWLINE# #UNINDENT# } , #NEWLINE# 'set2' : { #NEWLINE# #INDENT# 'first' : 1 , #NEWLINE# 'second' : None , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( form . raw_data , MultiDict ( ** { #NEWLINE# #INDENT# 'sets.set1.first' : '' , #NEWLINE# 'sets.set1.second' : '2' , #NEWLINE# 'sets.set2.first' : '1' , #NEWLINE# 'sets.set2.second' : '' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assert_ ( form . accept ( MultiDict ( ** { #NEWLINE# #INDENT# 'sets.set1.first' : 'incorect' , #NEWLINE# 'sets.set1.second' : '2' , #NEWLINE# 'sets.set2.first' : '1' , #NEWLINE# 'sets.set2.second' : 'incorect' , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# self . assertEqual ( env . python_data , { #NEWLINE# #INDENT# 'sets' : { #NEWLINE# #INDENT# 'set1' : { #NEWLINE# #INDENT# 'first' : None , #NEWLINE# 'second' : 2 , #NEWLINE# #UNINDENT# } , #NEWLINE# 'set2' : { #NEWLINE# #INDENT# 'first' : 1 , #NEWLINE# 'second' : None , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( form . raw_data , MultiDict ( ** { #NEWLINE# #INDENT# 'sets.set1.first' : '' , #NEWLINE# 'sets.set1.second' : '2' , #NEWLINE# 'sets.set2.first' : '1' , #NEWLINE# 'sets.set2.second' : '' , #NEWLINE# #UNINDENT# } ) )