#NEWLINE# def test_validation( self ) : #NEWLINE# #INDENT# self . cf . register_option ( 'a' , 1 , 'doc' , validator = self . cf . is_int ) #NEWLINE# self . cf . register_option ( 'b.c' , 'hullo' , 'doc2' , validator = self . cf . is_text ) #NEWLINE# self . assertRaises ( ValueError , validator . cf . register_option , 'a.b.c.d2' , 'NO' , 'doc' , validator = self . cf . is_int ) #NEWLINE# self . cf . set_option ( 'a' , 2 ) #NEWLINE# self . cf . set_option ( 'b.c' , 'wurld' ) #NEWLINE# self . assertRaises ( ValueError , self . cf . set_option , 'a' , None ) #NEWLINE# self . assertRaises ( ValueError , self . cf . set_option , 'a' , 'ab' ) #NEWLINE# self . assertRaises ( ValueError , self . cf . set_option , 'b.c' , 1 ) #NEWLINE# validator = self . cf . is_one_of_factory ( [ None , self . cf . is_callable ] ) #NEWLINE# self . cf . register_option ( 'b' , ( lambda : None ) , 'doc' , validator = validator ) #NEWLINE# self . cf . set_option ( 'b' , '%.1f' . format ) #NEWLINE# self . cf . set_option ( 'b' , None ) #NEWLINE# self . assertRaises ( ValueError , self . cf . set_option , 'b' , '%.1f' )