#NEWLINE# def test_method_parser( self ) : #NEWLINE# #INDENT# working_sigs = [ ( 'jsonrpc' , 'jsonrpc' , OrderedDict ( ) , Any ) , ( 'jsonrpc.methodName' , 'jsonrpc.methodName' , OrderedDict ( ) , Any ) , ( 'jsonrpc.methodName() -> list' , 'jsonrpc.methodName' , OrderedDict ( ) , list ) , ( 'jsonrpc.methodName(str, str, str) ' , 'jsonrpc.methodName' , OrderedDict ( [ ( 'a' , str ) , ( 'b' , str ) , ( 'c' , str ) ] ) , Any ) , ( 'jsonrpc.methodName(str, b=str, c=str)' , 'jsonrpc.methodName' , OrderedDict ( [ ( 'a' , str ) , ( 'b' , str ) , ( 'c' , str ) ] ) , Any ) , ( 'jsonrpc.methodName(str, b=str) -> dict' , 'jsonrpc.methodName' , OrderedDict ( [ ( 'a' , str ) , ( 'b' , str ) ] ) , dict ) , ( 'jsonrpc.methodName(str, str, c=Any) -> Any' , 'jsonrpc.methodName' , OrderedDict ( [ ( 'a' , str ) , ( 'b' , str ) , ( 'c' , Any ) ] ) , Any ) , ( 'jsonrpc(Any) -> Any' , 'jsonrpc' , OrderedDict ( [ ( 'a' , Any ) ] ) , Any ) ] #NEWLINE# error_sigs = [ ( 'jsonrpc(nowai) -> Any' , ValueError ) , ( 'jsonrpc(str) -> nowai' , ValueError ) , ( 'jsonrpc(nowai=str, str)' , ValueError ) , ( 'jsonrpc.methodName(nowai*str) -> Any' , ValueError ) ] #NEWLINE# for sig in working_sigs : #NEWLINE# #INDENT# ret = _parse_sig ( sig [ 0 ] , list ( iter ( sig [ 2 ] ) ) ) #NEWLINE# self . assertEqual ( ret [ 0 ] , sig [ 1 ] ) #NEWLINE# self . assertEqual ( ret [ 1 ] , sig [ 2 ] ) #NEWLINE# self . assertEqual ( ret [ 2 ] , sig [ 3 ] ) #NEWLINE# #UNINDENT# for sig in error_sigs : #NEWLINE# #INDENT# e = None #NEWLINE# try : #NEWLINE# #INDENT# p = _parse_sig ( sig [ 0 ] , [ 'a' ] ) #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# e = exc #NEWLINE# #UNINDENT# self . assertTrue ( ( type ( e ) is sig [ 1 ] ) )