code: def test_fetch_neurovault(tmp_path):
      # check that nothing is downloaded in offline mode
      data = neurovault.fetch_neurovault(
          mode="offline", data_dir=tmp_path
      )
  
      assert len(data.images) == 0
  
      # try to download an image
      data = neurovault.fetch_neurovault(
          max_images=11,
          fetch_neurosynth_words=True,
          mode="overwrite",
          data_dir=tmp_path,
      )
      # specifying a filter while leaving the default term
      # filters in place should raise a warning.
      with pytest.warns(UserWarning):
          neurovault.fetch_neurovault(
              image_filter=lambda x: True, max_images=1, mode="offline"
          )
  
      assert data.images
      assert len(data.images) == 11
      for meta in data.images_meta:
          assert not meta["not_mni"]
          assert not meta["is_thresholded"]
          assert meta["map_type"] not in [
              "ROI/mask",
              "anatomical",
              "parcellation",
          ]
          assert meta["image_type"] != "atlas"
  
      # using a data directory we can't write into should raise a
      # warning unless mode is 'offline'
      os.chmod(tmp_path, stat.S_IREAD | stat.S_IEXEC)
      os.chmod(
          os.path.join(tmp_path, "neurovault"),
          stat.S_IREAD | stat.S_IEXEC,
      )
      if os.access(os.path.join(tmp_path, "neurovault"), os.W_OK):
          return
  
      with pytest.warns(UserWarning):
          neurovault.fetch_neurovault(data_dir=tmp_path)
  
imports: import hashlib
  import json
  import os
  import re
  import stat
  from urllib import parse
  import numpy
  import pandas
  import pytest
  import requests
  from nilearn._utils.data_gen import generate_fake_fmri
  from nilearn.conftest import _rng
  from nilearn.datasets import neurovault
  from nilearn.image import load_img
label_desc: Use image node_id 40 for calling a global function with example usage: test_fetch_neurovault(tmp_path) without return types