code: def test_add_patch_info(monkeypatch):
      """Test adding patch info to source space."""
      # let's setup a small source space
      src = _read_small_src(remove=False)
      src_new = _read_small_src()
  
      # test that no patch info is added for small dist_limit
      add_source_space_distances(src_new, dist_limit=0.00001)
      assert all(s["nearest"] is None for s in src_new)
      assert all(s["nearest_dist"] is None for s in src_new)
      assert all(s["pinfo"] is None for s in src_new)
  
      # now let's use one that works (and test our warning-throwing)
      with monkeypatch.context() as m:
          m.setattr(
              mne.source_space._source_space, "_DIST_WARN_LIMIT", 1
          )
          with pytest.warns(
              RuntimeWarning, match="Computing distances for 258"
          ):
              add_source_space_distances(src_new)
      _compare_source_spaces(src, src_new, "approx")
  
      src_nodist = src.copy()
      for s in src_nodist:
          for key in ("dist", "dist_limit"):
              s[key] = None
      add_source_space_distances(src_new, dist_limit=0)
      _compare_source_spaces(src, src_new, "approx")
  
imports: from pathlib import Path
  from shutil import copytree
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less, assert_equal
  import mne
  from mne import SourceEstimate, add_source_space_distances, compute_source_morph, get_volume_labels_from_src, make_sphere_model, morph_source_spaces, pick_types, read_bem_solution, read_bem_surfaces, read_freesurfer_lut, read_source_spaces, read_trans, setup_source_space, setup_volume_source_space, write_source_spaces
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import _picks_to_idx
  from mne.datasets import testing
  from mne.fixes import _get_img_fdata
  from mne.source_estimate import _get_src_type
  from mne.source_space import compute_distance_to_sensors, get_decimated_surfaces
  from mne.source_space._source_space import _compare_source_spaces
  from mne.surface import _accumulate_normals, _triangle_neighbors
  from mne.utils import _record_warnings, requires_mne, run_subprocess
label_desc: Use image node_id 3 for calling a global function with example usage: test_add_patch_info(monkeypatch) without return types