#NEWLINE# def test_new_callable_failure( self ) : #NEWLINE# #INDENT# original_f = Foo . f #NEWLINE# original_g = Foo . g #NEWLINE# original_foo = Foo . foo #NEWLINE# def crasher( ) : #NEWLINE# #INDENT# raise NameError ( 'crasher' ) #NEWLINE# #UNINDENT# @ patch . object ( Foo , 'g' , 1 ) #NEWLINE# @ patch . object ( Foo , 'foo' , new_callable = crasher ) #NEWLINE# @ patch . object ( Foo , 'f' , 1 ) #NEWLINE# def thing1( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ patch . object ( Foo , 'foo' , new_callable = crasher ) #NEWLINE# @ patch . object ( Foo , 'g' , 1 ) #NEWLINE# @ patch . object ( Foo , 'f' , 1 ) #NEWLINE# def thing2( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ patch . object ( Foo , 'g' , 1 ) #NEWLINE# @ patch . object ( Foo , 'f' , 1 ) #NEWLINE# @ patch . object ( Foo , 'foo' , new_callable = crasher ) #NEWLINE# def thing3( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# for func in ( thing1 , thing2 , thing3 ) : #NEWLINE# #INDENT# self . assertRaises ( NameError , func ) #NEWLINE# self . assertEqual ( Foo . f , original_f ) #NEWLINE# self . assertEqual ( Foo . g , original_g ) #NEWLINE# self . assertEqual ( Foo . foo , original_foo )