#NEWLINE# def test_Dispatcher( ) : #NEWLINE# #INDENT# foo = Dispatcher ( ) #NEWLINE# foo . register ( int , ( lambda a , b , c = 1 : ( ( a + b ) + c ) ) ) #NEWLINE# foo . register ( float , ( lambda a , b , c = 1 : ( ( a - b ) + c ) ) ) #NEWLINE# foo . register ( object , ( lambda a , b , c = 1 : 10 ) ) #NEWLINE# class Bar ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# b = Bar ( ) #NEWLINE# assert ( foo ( 1 , 2 ) == 4 ) #NEWLINE# assert ( foo ( 1 , 2.0 , 3.0 ) == 6.0 ) #NEWLINE# assert ( foo ( 1.0 , 2.0 , 3.0 ) == 2.0 ) #NEWLINE# assert ( foo ( foo , 2 ) == 10 )