code: def test_num_titles_classes(arr_plot_blues):
      """Test that the number of classes equals the number of legend titles."""
  
      im_ax, _ = arr_plot_blues
  
      with pytest.raises(
          ValueError,
          match="The number of classes should equal the number of titles",
      ):
          ep.draw_legend(
              im_ax=im_ax,
              classes=[1, 2],
              titles=["small", "medium", "large"],
          )
  
      with pytest.raises(
          ValueError,
          match="The number of classes should equal the number of titles",
      ):
          ep.draw_legend(
              im_ax=im_ax, classes=[1, 2, 3], titles=["small", "large"]
          )
      plt.close()
  
imports: import numpy
  import pytest
  import matplotlib
  import matplotlib.pyplot
  from matplotlib.colors import ListedColormap
  import earthpy.plot
label_desc: Use image node_id 8 for calling a global function with example usage: test_num_titles_classes(arr_plot_blues) without return types