code: def test_element_picking(mode):
      class Tracker:
          def __init__(self):
              self.last_picked = None
  
          def __call__(self, picked):
              self.last_picked = picked
  
      tracker = Tracker()
  
      mesh = pv.Wavelet()
      plotter = pv.Plotter(
          window_size=(100, 100),
      )
      plotter.add_mesh(mesh)
      plotter.enable_element_picking(
          mode=mode,
          show_message=True,
          left_clicking=True,
          callback=tracker,
      )
      # must show to activate the interactive renderer (for left_clicking)
      plotter.show(auto_close=False)
  
      # simulate the pick
      width, height = plotter.window_size
  
      plotter.iren._mouse_left_button_click(width // 2, height // 2)
  
      plotter.close()
  
      assert tracker.last_picked is not None
  
      if mode == "mesh":
          assert tracker.last_picked == mesh
      elif mode == "cell":
          assert tracker.last_picked.n_points == 8
      elif mode == "face":
          assert tracker.last_picked.n_points == 4
      elif mode == "edge":
          assert tracker.last_picked.n_points == 2
      elif mode == "point":
          assert isinstance(tracker.last_picked, pv.PolyData)
          assert tracker.last_picked.n_points == 1
  
imports: import os
  import numpy
  import pytest
  import vtk
  import pyvista
  from pyvista.plotting.errors import PyVistaPickingError
label_desc: Use image node_id 18 for calling a global function with example usage: test_element_picking(mode) without return types