code: def test_manifest_check_download(tmp_path, n_have, monkeypatch):
      """Test our manifest downloader."""
      monkeypatch.setattr(pooch, "retrieve", _fake_zip_fetch)
      destination = op.join(str(tmp_path), "empty")
      manifest_path = op.join(str(tmp_path), "manifest.txt")
      with open(manifest_path, "w") as fid:
          for fname in _zip_fnames:
              fid.write("%s\n" % fname)
      assert n_have in range(len(_zip_fnames) + 1)
      assert not op.isdir(destination)
      if n_have > 0:
          os.makedirs(op.join(destination, "foo"))
          assert op.isdir(op.join(destination, "foo"))
      for fname in _zip_fnames:
          assert not op.isfile(op.join(destination, fname))
      for fname in _zip_fnames[:n_have]:
          with open(op.join(destination, fname), "w"):
              pass
      with catch_logging() as log:
          with use_log_level(True):
              # we mock the pooch.retrieve so these are not used
              url = hash_ = ""
              _manifest_check_download(
                  manifest_path, destination, url, hash_
              )
      log = log.getvalue()
      n_missing = 3 - n_have
      assert (
          "%d file%s missing from" % (n_missing, _pl(n_missing))
      ) in log
      for want in ("Extracting missing", "Successfully "):
          if n_missing > 0:
              assert want in log
          else:
              assert want not in log
      assert op.isdir(destination)
      for fname in _zip_fnames:
          assert op.isfile(op.join(destination, fname))
  
imports: import os
  import re
  import shutil
  import zipfile
  from functools import partial
  from os import path
  import pooch
  import pytest
  from mne import datasets, read_labels_from_annot, write_labels_to_annot
  from mne.datasets import fetch_dataset, fetch_infant_template, fetch_phantom, testing
  from mne.datasets._fsaverage.base import _set_montage_coreg_path
  from mne.datasets._infant import base
  from mne.datasets._phantom import base
  from mne.datasets.utils import _manifest_check_download
  from mne.utils import ArgvSetter, _pl, catch_logging, get_subjects_dir, hashfunc, requires_good_network, use_log_level
label_desc: Use image node_id 5 for calling a global function with example usage: test_manifest_check_download(tmp_path, n_have, monkeypatch) without return types