Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(40)  |  Call(40)  |  Derive(0)  |  Import(0)
Fail immediately, with the given message.

src/g/s/gsutil-3.42/gslib/tests/test_naming.py   gsutil(Download)
    try:
      self.RunCommand('cp', [src_dir, dst_dir])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('No URIs matched', e.reason)
    try:
      self.RunCommand('cp', ['gs://', suri(src_bucket_uri)])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('provider-only', e.reason)
    try:
      self.RunCommand('cp', [src_file, src_file])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('are the same file - abort', e.reason)
      self.RunCommand('cp', [suri(src_bucket_uri, 'obj0'),
                             suri(src_bucket_uri, '*')])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertNotEqual(e.reason.find('must match exactly 1 URI'), -1)
    try:
      self.RunCommand('cp', ['-R', suri(src_bucket_uri, '*'), dst_file])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('must name a directory, bucket, or', e.reason)

src/g/s/gsutil-HEAD/gslib/tests/test_naming.py   gsutil(Download)
    try:
      self.RunCommand('cp', [src_dir, dst_dir])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('No URIs matched', e.reason)
    try:
      self.RunCommand('cp', ['gs://', suri(src_bucket_uri)])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('provider-only', e.reason)
    try:
      self.RunCommand('cp', [src_file, src_file])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('are the same file - abort', e.reason)
      self.RunCommand('cp', [suri(src_bucket_uri, 'obj0'),
                             suri(src_bucket_uri, '*')])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertNotEqual(e.reason.find('must match exactly 1 URI'), -1)
    try:
      self.RunCommand('cp', ['-R', suri(src_bucket_uri, '*'), dst_file])
      self.fail('Did not get expected CommandException')
    except CommandException, e:
      self.assertIn('must name a directory, bucket, or', e.reason)

src/g/s/gsutil-3.42/gslib/tests/test_wildcard_iterator.py   gsutil(Download)
          bucket_storage_uri_class=self.mock_bucket_storage_uri):
        iter_result.GetKey()
        self.fail('Expected BucketListingRefException not raised.')
    except BucketListingRefException, e:
      self.assertTrue(str(e).find(
      uri = self._test_storage_uri(suri(self.test_dir, '***', 'abcd'))
      for unused_ in self._test_wildcard_iterator(uri).IterUris():
        self.fail('Expected WildcardException not raised.')
    except wildcard_iterator.WildcardException, e:
      # Expected behavior.

src/g/s/gsutil-HEAD/gslib/tests/test_wildcard_iterator.py   gsutil(Download)
          bucket_storage_uri_class=self.mock_bucket_storage_uri):
        iter_result.GetKey()
        self.fail('Expected BucketListingRefException not raised.')
    except BucketListingRefException, e:
      self.assertTrue(str(e).find(
      uri = self._test_storage_uri(suri(self.test_dir, '***', 'abcd'))
      for unused_ in self._test_wildcard_iterator(uri).IterUris():
        self.fail('Expected WildcardException not raised.')
    except wildcard_iterator.WildcardException, e:
      # Expected behavior.

src/g/s/gsutil-3.42/gslib/tests/test_parallelism_framework.py   gsutil(Download)
    def _ExpectCustomException(test_func):
      try:
        test_func()
        self.fail(
            'Setting fail_on_error should raise any exception encountered.')
      except CustomException, e:
        pass
      except Exception, e:
        self.fail("Got unexpected error: " + str(e))
    try:
      self._RunApply(_ReturnOneValue, args, process_count, thread_count)
      self.fail("Did not throw expected exception.")
    except TypeError, e:
      pass

src/g/s/gsutil-HEAD/gslib/tests/test_parallelism_framework.py   gsutil(Download)
    def _ExpectCustomException(test_func):
      try:
        test_func()
        self.fail(
            'Setting fail_on_error should raise any exception encountered.')
      except CustomException, e:
        pass
      except Exception, e:
        self.fail("Got unexpected error: " + str(e))
    try:
      self._RunApply(_ReturnOneValue, args, process_count, thread_count)
      self.fail("Did not throw expected exception.")
    except TypeError, e:
      pass