#NEWLINE# @ mock . patch ( 'PIL.Image.Image.load' , side_effect = IOError ) #NEWLINE# def test_load_with_io_error( self , mock_image_load ) : #NEWLINE# #INDENT# with self . assertRaises ( ThumbnailError ) : #NEWLINE# #INDENT# self . engine . engine_load_image ( mock_image_load . file ) #NEWLINE# #UNINDENT# self . assertTrue ( mock_image_load . called )