code: def assert_select_subplots(
      self,
      subplot_type,
      subplots_name,
      expected_nums,
      selector=None,
      row=None,
      col=None,
      secondary_y=None,
      test_no_grid=False,
  ):
      select_fn = getattr(Figure, "select_" + subplots_name)
      for_each_fn = getattr(Figure, "for_each_" + subplot_type)
  
      if secondary_y is not None:
          sec_y_args = dict(secondary_y=secondary_y)
      else:
          sec_y_args = {}
  
      def check_select(fig):
          # Check select_*
          subplots = list(
              select_fn(
                  fig, selector=selector, row=row, col=col, **sec_y_args
              )
          )
          expected_keys = [
              subplot_type + (str(cnt) if cnt > 1 else "")
              for cnt in expected_nums
          ]
  
          self.assertEqual(len(subplots), len(expected_keys))
          self.assertTrue(
              all(
                  v1 is fig.layout[k]
                  for v1, k in zip(subplots, expected_keys)
              )
          )
  
          # Check for_each_*
          subplots = []
          res = for_each_fn(
              fig,
              lambda obj: subplots.append(obj),
              selector=selector,
              row=row,
              col=col,
              **sec_y_args,
          )
  
          self.assertIs(res, fig)
  
          self.assertEqual(len(subplots), len(expected_keys))
          self.assertTrue(
              all(
                  v1 is fig.layout[k]
                  for v1, k in zip(subplots, expected_keys)
              )
          )
  
      check_select(self.fig)
      if test_no_grid:
          check_select(self.fig_no_grid)
  
imports: import copy
  from unittest import TestCase
  import plotly.graph_objs
  from plotly.graph_objs import Figure
  from plotly.subplots import make_subplots
label_desc: Use image node_id 2 for calling the TestSelectForEachUpdateSubplots obj's underlying member method code with example usage: obj.assert_select_subplots(subplot_type, subplots_name, expected_nums, selector, row, col, secondary_y, test_no_grid) without return types