#NEWLINE# def test_patch_keyword_args( self ) : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# 'side_effect' : KeyError , #NEWLINE# 'foo.bar.return_value' : 33 , #NEWLINE# 'foo' : MagicMock ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# patcher = patch ( foo_name , ** kwargs ) #NEWLINE# mock = patcher . start ( ) #NEWLINE# patcher . stop ( ) #NEWLINE# self . assertRaises ( KeyError , self ) #NEWLINE# self . assertEqual ( mock . foo . bar ( ) , 33 ) #NEWLINE# self . assertIsInstance ( mock . foo , MagicMock )