#NEWLINE# def testValidateDataType( self ) : #NEWLINE# #INDENT# 'Test _ValidateDataType() against different inputs.' #NEWLINE# nothing = 'xnothingx' #NEWLINE# tests = [ [ '3.0' , 'float' , nothing , nothing ] , [ 'x' , 'float' , nothing , load_lib . EncryptConvertError ] , [ '3' , 'integer' , nothing , nothing ] , [ 'y' , 'integer' , nothing , load_lib . EncryptConvertError ] , [ 'abc' , 'string' , None , nothing ] , [ 'junk' , 'invalid type_value' , None , nothing ] ] #NEWLINE# for ( data_value , type_value , expect_output , expect_exception ) in tests : #NEWLINE# #INDENT# if ( expect_exception is not nothing ) : #NEWLINE# #INDENT# self . assertRaises ( expect_exception , load_lib . _ValidateDataType , type_value , data_value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# output = load_lib . _ValidateDataType ( type_value , data_value ) #NEWLINE# if ( expect_output is not nothing ) : #NEWLINE# #INDENT# self . assertEqual ( output , expect_output ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertTrue ( ( output is None ) )