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