code: def test_plot_sensors(raw):
      """Test plotting of sensor array."""
      plt.close("all")
      fig = raw.plot_sensors("3d")
      _fake_click(fig, fig.gca(), (-0.08, 0.67))
      raw.plot_sensors(
          "topomap", ch_type="mag", show_names=["MEG 0111", "MEG 0131"]
      )
      plt.close("all")
      ax = plt.subplot(111)
      raw.plot_sensors(ch_groups="position", axes=ax)
      raw.plot_sensors(ch_groups="selection", to_sphere=False)
      raw.plot_sensors(ch_groups=[[0, 1, 2], [3, 4]])
      raw.plot_sensors(ch_groups=np.array([[0, 1, 2], [3, 4, 5]]))
      raw.plot_sensors(
          ch_groups=np.array([[0, 1, 2], [3, 4]], dtype=object)
      )
      pytest.raises(ValueError, raw.plot_sensors, ch_groups="asd")
      pytest.raises(TypeError, plot_sensors, raw)  # needs to be info
      pytest.raises(ValueError, plot_sensors, raw.info, kind="sasaasd")
      plt.close("all")
      fig, sels = raw.plot_sensors("select", show_names=True)
      ax = fig.axes[0]
  
      # Click with no sensors
      _fake_click(fig, ax, (0.0, 0.0), xform="data")
      _fake_click(fig, ax, (0, 0.0), xform="data", kind="release")
      assert fig.lasso.selection == []
  
      # Lasso with 1 sensor (upper left)
      _fake_click(fig, ax, (0, 1), xform="ax")
      fig.canvas.draw()
      assert fig.lasso.selection == []
      _fake_click(fig, ax, (0.65, 1), xform="ax", kind="motion")
      _fake_click(fig, ax, (0.65, 0.7), xform="ax", kind="motion")
      _fake_keypress(fig, "control")
      _fake_click(
          fig, ax, (0, 0.7), xform="ax", kind="release", key="control"
      )
      assert fig.lasso.selection == ["MEG 0121"]
  
      # check that point appearance changes
      fc = fig.lasso.collection.get_facecolors()
      ec = fig.lasso.collection.get_edgecolors()
      assert (fc[:, -1] == [0.5, 1.0, 0.5]).all()
      assert (ec[:, -1] == [0.25, 1.0, 0.25]).all()
  
      _fake_click(
          fig, ax, (0.7, 1), xform="ax", kind="motion", key="control"
      )
      xy = ax.collections[0].get_offsets()
      _fake_click(
          fig, ax, xy[2], xform="data", key="control"
      )  # single sel
      assert fig.lasso.selection == ["MEG 0121", "MEG 0131"]
      _fake_click(
          fig, ax, xy[2], xform="data", key="control"
      )  # deselect
      assert fig.lasso.selection == ["MEG 0121"]
      plt.close("all")
  
      raw.info["dev_head_t"] = None  # like empty room
      with pytest.warns(RuntimeWarning, match="identity"):
          raw.plot_sensors()
  
      # Test plotting with sphere='eeglab'
      info = create_info(
          ch_names=["Fpz", "Oz", "T7", "T8"], sfreq=100, ch_types="eeg"
      )
      data = 1e-6 * np.random.rand(4, 100)
      raw_eeg = RawArray(data=data, info=info)
      raw_eeg.set_montage("biosemi64")
      raw_eeg.plot_sensors(sphere="eeglab")
  
      # Should work with "FPz" as well
      raw_eeg.rename_channels({"Fpz": "FPz"})
      raw_eeg.plot_sensors(sphere="eeglab")
  
      # Should still work without Fpz/FPz, as long as we still have Oz
      raw_eeg.drop_channels("FPz")
      raw_eeg.plot_sensors(sphere="eeglab")
  
      # Should raise if Oz is missing too, as we cannot reconstruct Fpz anymore
      raw_eeg.drop_channels("Oz")
      with pytest.raises(ValueError, match="could not find: Fpz"):
          raw_eeg.plot_sensors(sphere="eeglab")
  
      # Should raise if we don't have a montage
      chs = deepcopy(raw_eeg.info["chs"])
      raw_eeg.set_montage(None)
      with raw_eeg.info._unlock():
          raw_eeg.info["chs"] = chs
      with pytest.raises(ValueError, match="No montage was set"):
          raw_eeg.plot_sensors(sphere="eeglab")
  
imports: import itertools
  import os
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pytest
  from matplotlib import backend_bases
  from numpy.testing import assert_allclose
  from mne import Annotations, create_info, pick_types
  from mne._fiff.pick import _DATA_CH_TYPES_ORDER_DEFAULT, _PICK_TYPES_DATA_DICT
  from mne.annotations import _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray
  from mne.utils import _assert_no_instances, _dt_to_stamp, _record_warnings, check_version, get_config, set_config
  from mne.viz import plot_raw, plot_sensors
  from mne.viz.utils import _fake_click, _fake_keypress
label_desc: Use image node_id 30 for calling a global function with example usage: test_plot_sensors(raw) without return types