#NEWLINE# def test_patch_dict_with_container_object_and_clear( self ) : #NEWLINE# #INDENT# foo = Container ( ) #NEWLINE# foo [ 'initial' ] = object ( ) #NEWLINE# foo [ 'other' ] = 'something' #NEWLINE# original = foo . values . copy ( ) #NEWLINE# @ patch . dict ( foo , clear = True ) #NEWLINE# def test( ) : #NEWLINE# #INDENT# self . assertEqual ( foo . values , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# foo [ 'a' ] = 3 #NEWLINE# foo [ 'other' ] = 'something else' #NEWLINE# #UNINDENT# test ( ) #NEWLINE# self . assertEqual ( foo . values , foo ) #NEWLINE# @ patch . dict ( foo , { #NEWLINE# #INDENT# 'a' : 'b' , #NEWLINE# #UNINDENT# } , clear = True ) #NEWLINE# def test( ) : #NEWLINE# #INDENT# self . assertEqual ( foo . values , { #NEWLINE# #INDENT# 'a' : 'b' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# test ( ) #NEWLINE# self . assertEqual ( foo . values , original )