#NEWLINE# def test_patch_class_decorator( self ) : #NEWLINE# #INDENT# class Something ( object ) : #NEWLINE# #INDENT# attribute = sentinel . Original #NEWLINE# #UNINDENT# class Foo ( object ) : #NEWLINE# #INDENT# def test_method( other_self , mock_something ) : #NEWLINE# #INDENT# self . assertEqual ( PTModule . something , mock_something , 'unpatched' ) #NEWLINE# #UNINDENT# def not_test_method( other_self ) : #NEWLINE# #INDENT# self . assertEqual ( PTModule . something , sentinel . Something , 'non-test method patched' ) #NEWLINE# #UNINDENT# #UNINDENT# Foo = patch ( ( '%s.something' % __name__ ) ) ( f ) #NEWLINE# f = Foo ( ) #NEWLINE# f . test_method ( ) #NEWLINE# f . not_test_method ( ) #NEWLINE# self . assertEqual ( Something . attribute , sentinel . Original , 'patch not restored' ) #NEWLINE# self . assertEqual ( PTModule . something , sentinel . Something , 'patch not restored' )