code: def test_plot_surf_roi_error(engine, rng):
      if not is_plotly_installed() and engine == "plotly":
          pytest.skip(
              "Plotly is not installed; required for this test."
          )
      mesh, roi_map, _ = _generate_data_test_surf_roi()
  
      # too many axes
      with pytest.raises(
          ValueError,
          match="roi_map can only have one dimension but has",
      ):
          plot_surf_roi(
              mesh, roi_map=np.array([roi_map, roi_map]), engine=engine
          )
  
      # wrong number of vertices
      roi_idx = rng.integers(0, mesh[0].shape[0], size=5)
      with pytest.raises(
          ValueError,
          match="roi_map does not have the same number of vertices",
      ):
          plot_surf_roi(mesh, roi_map=roi_idx, engine=engine)
  
      # negative value in roi map
      roi_map[0] = -1
      with pytest.warns(
          DeprecationWarning,
          match="Negative values in roi_map will no longer be allowed",
      ):
          plot_surf_roi(mesh, roi_map=roi_map, engine=engine)
  
      # float value in roi map
      roi_map[0] = 1.2
      with pytest.warns(
          DeprecationWarning,
          match="Non-integer values in roi_map will no longer be allowed",
      ):
          plot_surf_roi(mesh, roi_map=roi_map, engine=engine)
  
imports: import re
  import tempfile
  import unittest.mock
  import matplotlib.pyplot
  import numpy
  import pytest
  from matplotlib.figure import Figure
  from numpy.testing import assert_array_equal
  from nilearn._utils.helpers import is_kaleido_installed, is_plotly_installed
  from nilearn.conftest import _rng
  from nilearn.datasets import fetch_surf_fsaverage
  from nilearn.plotting.displays import PlotlySurfaceFigure
  from nilearn.plotting.surf_plotting import VALID_HEMISPHERES, VALID_VIEWS, _compute_facecolors_matplotlib, _get_ticks_matplotlib, _get_view_plot_surf_matplotlib, _get_view_plot_surf_plotly, plot_img_on_surf, plot_surf, plot_surf_contours, plot_surf_roi, plot_surf_stat_map
  from nilearn.surface import load_surf_data, load_surf_mesh
  from nilearn.surface.tests._testing import generate_surf
label_desc: Use image node_id 28 for calling a global function with example usage: test_plot_surf_roi_error(engine, rng) without return types