#NEWLINE# def test_patchobject_start_stop( self ) : #NEWLINE# #INDENT# original = something #NEWLINE# patcher = patch . object ( PTModule , 'something' , 'foo' ) #NEWLINE# self . assertIs ( something , original ) #NEWLINE# replaced = patcher . start ( ) #NEWLINE# self . assertEqual ( replaced , 'foo' ) #NEWLINE# try : #NEWLINE# #INDENT# self . assertIs ( something , replaced ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# patcher . stop ( ) #NEWLINE# #UNINDENT# self . assertIs ( something , original )