#NEWLINE# def testToListOf( self ) : #NEWLINE# #INDENT# 'Test the ToListOf converter.' #NEWLINE# cvtType = cvt . Converter ( cvt . toType , float ) #NEWLINE# converter = cvt . toListOf #NEWLINE# l1 = [ '123' , 1234.0 , 5 ] #NEWLINE# right = map ( float , l1 ) #NEWLINE# v = converter ( l1 , cvtType ) #NEWLINE# self . assertEqual ( right , v , 'Incorrect conversion of list.' ) #NEWLINE# v = converter ( right , cvtType ) #NEWLINE# self . assertEqual ( right , v , 'Incorrect conversion of floats.' ) #NEWLINE# v = converter ( tuple ( l1 ) , right ) #NEWLINE# self . assertEqual ( right , v , 'Incorrect conversion of tuples.' ) #NEWLINE# self . assertRaises ( Exception , converter , [ 'foo bar' ] , cvtType , name = 'value' , msg = 'Invalid string argument should be an error.' ) #NEWLINE# self . assertRaises ( Exception , converter , 'foo bar' , cvtType , name = 'value' , msg = 'Invalid non-list argument should be an error.' )