code: def test_distance_to_bem(bem_type, n_pos):
      """Test distance_to_bem."""
      # Test spherical ConductorModels
      if bem_type == "sphere":
          bem = make_sphere_model(r0=np.array([0, 0, 0]), verbose=0)
          r = bem["layers"][0]["rad"]
          true_dist = np.array(
              [r, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
          )
      else:
          bem = read_bem_solution(fname_bem_sol_1)
          r = 0.05
          true_dist = np.array(
              [
                  0.01708097,
                  0.00256595,
                  0.01022884,
                  0.02306622,
                  0.02927288,
                  0.04491787,
                  0.00990493,
                  0.02244751,
                  0.04819345,
                  0.01928304,
              ]
          )
  
      pos = np.array(
          [
              [0.0, 0.0, 0.0],
              [r, 0.0, 0.0],
              [-r, 0.0, 0.0],
              [0.0, r, 0.0],
              [0.0, -r, 0.0],
              [0.0, 0.0, r],
              [-r / np.sqrt(2.0), r / np.sqrt(2.0), 0.0],
              [-r / np.sqrt(2.0), -r / np.sqrt(2.0), 0.0],
              [0, -r / np.sqrt(2.0), r / np.sqrt(2.0)],
              [r / np.sqrt(3.0), r / np.sqrt(3.0), r / np.sqrt(3.0)],
          ]
      )
  
      if n_pos == 1:
          pos = pos[0, :]
          true_dist = true_dist[0]
  
      dist = distance_to_bem(pos, bem)
      if n_pos == 1:
          assert isinstance(dist, float)
      else:
          assert isinstance(dist, np.ndarray)
  
      assert_allclose(dist, true_dist, rtol=1e-6, atol=1e-6)
  
imports: import re
  from copy import deepcopy
  from os import makedirs
  from pathlib import Path
  from shutil import copy
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_equal
  import mne
  from mne import Info, Transform, make_bem_model, make_bem_solution, make_sphere_model, read_bem_solution, read_bem_surfaces, write_bem_solution, write_bem_surfaces, write_head_bem, write_surface
  from mne._fiff.constants import FIFF
  from mne.bem import _assert_complete_surface, _assert_inside, _bem_find_surface, _check_surface_size, _get_ico_map, _ico_downsample, _order_surfaces, distance_to_bem, fit_sphere_to_headshape, make_scalp_surfaces
  from mne.datasets import testing
  from mne.io import read_info
  from mne.surface import _get_ico_surface, read_surface
  from mne.transforms import translation
  from mne.utils import catch_logging, check_version
label_desc: Use image node_id 11 for calling a global function with example usage: test_distance_to_bem(bem_type, n_pos) without return types