#NEWLINE# def test_patch_multiple_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# patcher = patch . object ( Foo , 'f' , 1 ) #NEWLINE# patcher . attribute_name = 'f' #NEWLINE# good = patch . object ( Foo , 'g' , 1 ) #NEWLINE# good . attribute_name = 'g' #NEWLINE# bad = patch . object ( Foo , 'foo' , new_callable = crasher ) #NEWLINE# bad . attribute_name = 'foo' #NEWLINE# for additionals in ( [ good , bad ] , [ func , good ] ) : #NEWLINE# #INDENT# patcher . additional_patchers = additionals #NEWLINE# @ patcher #NEWLINE# def func( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# 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 )