code: def test_clear_on_download_err(tmp_dir, dvc, index, mocker):
      out = tmp_dir.dvc_gen({"dir": {"foo": "foo content"}})[0].outs[0]
      dvc.push()
  
      assert list(index.hashes())
  
      for _, _, hi in out.obj:
          remove(dvc.cache.local.get(hi.value).path)
          remove(dvc.cloud.get_remote().odb.get(hi.value).path)
      remove(out.fs_path)
  
      with pytest.raises(DownloadError):
          dvc.pull()
      assert not list(index.hashes())
  
file_path: dvc/tests/func/data/db/test_index.py
imports: import os
  import pytest
  from dvc.exceptions import DownloadError, UploadError
  from dvc.utils.fs import remove
  from dvc_data.hashfile.db import get_index
label_desc: Use image node_id 6 for calling a global function with example usage: test_clear_on_download_err(tmp_dir, dvc, index, mocker) without return types