code: def test_plot_ale_legend(label, explanation):
      """Test if the legend is displayed only for the first ax object with the expected text."""
      axes = plot_ale(exp=explanation, line_kw={"label": label}).ravel()
      assert axes[0].get_legend() is not None
      assert all([ax.get_legend() is None for ax in axes[1:]])
  
      texts = [
          text.get_text() for text in axes[0].get_legend().get_texts()
      ]
      if label is None:
          assert texts == explanation.data["target_names"].tolist()
      else:
          assert texts == label
  
imports: import re
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pytest
  from numpy.testing import assert_allclose
  from pytest_lazyfixture import lazy_fixture
  from alibi.api.defaults import DEFAULT_DATA_ALE, DEFAULT_META_ALE
  from alibi.api.interfaces import Explanation
  from alibi.explainers.ale import _plot_one_ale_num, adaptive_grid, ale_num, get_quantiles, minimum_satisfied, plot_ale
label_desc: Use image node_id 20 for calling a global function with example usage: test_plot_ale_legend(label, explanation) without return types