code: def test_select_legends_figure_index(figure_index, expected):
      overlays = [
          hv.Curve([0, 0]) * hv.Curve([1, 1]),
          hv.Curve([2, 2]) * hv.Curve([3, 3]),
      ]
      layout = hv.Layout(overlays)
      select_legends(layout, figure_index)
      output = [ol.opts["show_legend"] for ol in overlays]
      assert expected == output
  
file_path: holoviews/holoviews/tests/plotting/bokeh/test_utils.py
imports: import pytest
  import holoviews
  from holoviews.core import Store
  from holoviews.element.comparison import ComparisonTestCase
  from holoviews.plotting.bokeh.styles import expand_batched_style
  from holoviews.plotting.bokeh.util import filter_batched_data, glyph_order, select_legends
label_desc: Use image node_id 1 for calling a global function with example usage: test_select_legends_figure_index(figure_index, expected) without return types