def testDownloadThreadException(self):

    class DownloadException(Exception):
      pass

    write_values = [b'a', b'b',
                    DownloadException('Download thread forces failure')]
    upload_file = self.CreateTempFile()
    mock_api = self.MockDownloadCloudApi(write_values)
    daisy_chain_wrapper = DaisyChainWrapper(
        self._dummy_url, self.test_data_file_len, mock_api,
        download_chunk_size=self.test_data_file_len)
    try:
      self._WriteFromWrapperToFile(daisy_chain_wrapper, upload_file)
      self.fail('Expected exception')
    except DownloadException, e:
      self.assertIn('Download thread forces failure', str(e))
Decorator function that can be used to cache any function/method.
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/tests/test_daisy_chain_wrapper.py/TestDaisyChainWrapper.testDownloadThreadException--crossover with--dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/cache.py/Cache.__call__