code: def test_choose_correct_non_empty_subplots():
      # This checks to see that the correct subplots are selected for all
      # combinations of selectors
      fig = make_subplots(2, 2)
      fig.add_trace(go.Scatter(x=[1, 2], y=[3, 4]), row=1, col=1)
      fig.add_shape(
          dict(type="rect", x0=1, x1=2, y0=3, y1=4), row=1, col=2
      )
      fig.add_annotation(dict(text="A", x=1, y=2), row=2, col=1)
      fig.add_layout_image(
          dict(source="test", x=1, y=2, sizex=0.5, sizey=0.5),
          row=2,
          col=2,
      )
      all_subplots = get_non_empty_subplots(fig, "all")
      selectors = all_combos(
          ["traces", "shapes", "annotations", "images"]
      )
      subplot_combos = all_combos(all_subplots)
      assert len(selectors) == len(subplot_combos)
      for s, spc in zip(selectors, subplot_combos):
          sps = tuple(get_non_empty_subplots(fig, s))
          assert sps == spc
  
file_path: plotly.py/packages/python/plotly/plotly/tests/test_core/test_subplots/test_find_nonempty_subplots.py
imports: import pytest
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  from itertools import combinations, product
  from functools import reduce
label_desc: Use image node_id 4 for calling a global function with example usage: test_choose_correct_non_empty_subplots() without return types