#NEWLINE# def test_setup_argument( self ) : #NEWLINE# #INDENT# def set_matching_0( val , sender ) : #NEWLINE# #INDENT# set_matching_0 . ret = ( len ( val ) == 0 ) #NEWLINE# #UNINDENT# def set_matching_1( val , sender ) : #NEWLINE# #INDENT# set_matching_1 . ret = ( set ( val ) == set ( [ 'test1' ] ) ) #NEWLINE# #UNINDENT# def set_matching_2( val , sender ) : #NEWLINE# #INDENT# set_matching_2 . ret = ( set ( val ) == set ( [ 'test1' , 'test2' ] ) ) #NEWLINE# #UNINDENT# def ret_val( val , sender ) : #NEWLINE# #INDENT# ret_val . ret = val #NEWLINE# #UNINDENT# def direct_cmd_set_match( match , cmd , sender ) : #NEWLINE# #INDENT# direct_cmd_set_match . ret = ( set ( match ) == set ( [ 'kaydada' ] ) ) #NEWLINE# #UNINDENT# test_list = [ [ '-subscribe test1' , '_subscribe' , set_matching_1 ] , [ '-subscribe test1 test2' , '_subscribe' , set_matching_2 ] , [ '-unsubscribe test1' , '_unsubscribe' , set_matching_1 ] , [ '-unsubscribe test1 test2' , '_unsubscribe' , set_matching_2 ] , [ '-unsuball' , '_unsub_all' , ret_val ] , [ '-unsuball abc' , '_unsub_all' , ret_val ] , [ '-import test1' , '_import' , set_matching_1 ] , [ '-listchannel' , '_list_channel' , ret_val ] , [ '-listchannel abc' , '_list_channel' , ret_val ] , [ '-refresh' , '_refresh' , ret_val ] , [ '-refresh abc' , '_refresh' , ret_val ] , [ '-listusers' , '_list_users' , set_matching_0 ] , [ '-listusers test1' , '_list_users' , set_matching_1 ] , [ '-listusers test1 test2' , '_list_users' , set_matching_2 ] ] #NEWLINE# for test in test_list : #NEWLINE# #INDENT# self . setUp ( ) #NEWLINE# method_bak = None #NEWLINE# for ( name , method ) in inspect . getmembers ( self . service , predicate = inspect . ismethod ) : #NEWLINE# #INDENT# if ( name == test [ 1 ] ) : #NEWLINE# #INDENT# method_bak = method #NEWLINE# setattr ( self . service , name , test [ 2 ] ) #NEWLINE# #UNINDENT# #UNINDENT# ok_ ( ( method_bak is not None ) , ( test [ 0 ] + ' case method not found' ) ) #NEWLINE# self . service . setup ( self . parser ) #NEWLINE# cmd = ( ( self . service . CMD + ' ' ) + test [ 0 ] ) #NEWLINE# ( args , unknowns ) = self . parser . parse_known_args ( cmd . split ( ) ) #NEWLINE# test [ 2 ] . ret = False #NEWLINE# args . proc ( args , None ) #NEWLINE# ok_ ( test [ 2 ] . ret , ( 'failed: ' + test [ 0 ] ) ) #NEWLINE# #UNINDENT# test_list = [ [ 'www.twitch.tv/kaydada' , '_sub_by_url' , direct_cmd_set_match ] ] #NEWLINE# for test in test_list : #NEWLINE# #INDENT# self . setUp ( ) #NEWLINE# method_bak = None #NEWLINE# for ( name , method ) in inspect . getmembers ( self . service , predicate = inspect . ismethod ) : #NEWLINE# #INDENT# if ( name == test [ 1 ] ) : #NEWLINE# #INDENT# method_bak = method #NEWLINE# setattr ( self . service , name , test [ 2 ] ) #NEWLINE# #UNINDENT# #UNINDENT# ok_ ( ( method_bak is not None ) , ( test [ 0 ] + ' case method not found' ) ) #NEWLINE# self . service . setup ( self . parser ) #NEWLINE# cmd = test [ 0 ] #NEWLINE# self . parser . process_direct_commands ( cmd , None ) #NEWLINE# ok_ ( unknowns [ 2 ] . ret , ( 'failed: ' + test [ 0 ] ) )