#NEWLINE# @ patch ( 'mock.patch.TEST_PREFIX' , 'bar' ) #NEWLINE# def test_patch_dict_test_prefix( self ) : #NEWLINE# #INDENT# class Foo ( object ) : #NEWLINE# #INDENT# def bar_one( self ) : #NEWLINE# #INDENT# return dict ( the_dict ) #NEWLINE# #UNINDENT# def bar_two( self ) : #NEWLINE# #INDENT# return dict ( the_dict ) #NEWLINE# #UNINDENT# def test_one( self ) : #NEWLINE# #INDENT# return dict ( the_dict ) #NEWLINE# #UNINDENT# def test_two( self ) : #NEWLINE# #INDENT# return dict ( the_dict ) #NEWLINE# #UNINDENT# #UNINDENT# the_dict = { #NEWLINE# #INDENT# 'key' : 'original' , #NEWLINE# #UNINDENT# } #NEWLINE# Foo = patch . dict ( the_dict , key = 'changed' ) ( Foo ) #NEWLINE# foo = Foo ( ) #NEWLINE# self . assertEqual ( foo . bar_one ( ) , { #NEWLINE# #INDENT# 'key' : 'changed' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( foo . bar_two ( ) , { #NEWLINE# #INDENT# 'key' : 'changed' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( foo . test_one ( ) , { #NEWLINE# #INDENT# 'key' : 'original' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( foo . test_two ( ) , { #NEWLINE# #INDENT# 'key' : 'original' , #NEWLINE# #UNINDENT# } )