code: def assert_select_traces(
      self,
      expected_inds,
      selector=None,
      row=None,
      col=None,
      secondary_y=None,
      test_no_grid=False,
  ):
      # Select traces on figure initialized with make_subplots
      trace_generator = self.fig.select_traces(
          selector=selector, row=row, col=col, secondary_y=secondary_y
      )
      self.assertTrue(inspect.isgenerator(trace_generator))
  
      trace_list = list(trace_generator)
      self.assertEqual(
          trace_list, [self.fig.data[i] for i in expected_inds]
      )
  
      # Select traces on figure not containing subplot info
      if test_no_grid:
          trace_generator = self.fig_no_grid.select_traces(
              selector=selector,
              row=row,
              col=col,
              secondary_y=secondary_y,
          )
          trace_list = list(trace_generator)
          self.assertEqual(
              trace_list,
              [self.fig_no_grid.data[i] for i in expected_inds],
          )
  
      # Test for each trace
      trace_list = []
      for_each_res = self.fig.for_each_trace(
          lambda t: trace_list.append(t),
          selector=selector,
          row=row,
          col=col,
          secondary_y=secondary_y,
      )
      self.assertIs(for_each_res, self.fig)
  
      self.assertEqual(
          trace_list, [self.fig.data[i] for i in expected_inds]
      )
  
imports: from unittest import TestCase
  import inspect
  import copy
  import pytest
  import plotly.graph_objs
  from plotly.subplots import make_subplots
  from functools import reduce
label_desc: Use image node_id 2 for calling the TestSelectForEachUpdateTraces obj's underlying member method code with example usage: obj.assert_select_traces(expected_inds, selector, row, col, secondary_y, test_no_grid) without return types