class_docstr: This tests that the progress bar correctly shows a "100%" message at some point in
  the relevant computations.  Progress bars are shown for calls to the `influence`
  method for all 3 modes.  This is why 3 different modes are tested, and the mode
  being tested is a parameter in the test.  `TracInCPFastRandProj.influence` is not
  tested, because none of its modes involve computations over the entire training
  dataset, so that no progress bar is shown (the computation is instead done in
  `TracInCPFastRandProj.__init__`.  TODO: add progress bar for computations done
  in `TracInCPFastRandProj.__init__`).
docstr: Checks that in `mock_stderr`, the error msg `msg` occurs `msg_multiplicity`
  times. If 'greater_than' is true, it checks that the `msg` occurs at least
  `msg_multiplicity` times. Otherwise, it checks that `msg` occurs exactly
  `msg_multiplicity` times. The reason to let `greater_than` as true by default
  is that tqdm sometimes displays the "100%" more than once for each progress bar
  because it may want to correct its estimation of it/s. In this case, the
  tqdm could remove the original "100%" and then re-display "100%" with the
  updated estimate of it/s.
docstr_tok: ["Checks","that","in","`","mock_stderr","`",",","the","error","msg","`","msg","`","occurs","`","msg_multiplicity","`","times",".","If","'greater_than","'","is","true",",","it","checks","that","the","`","msg","`","occurs","at","least","`","msg_multiplicity","`","times",".","Otherwise",",","it","checks","that","`","msg","`","occurs","exactly","`","msg_multiplicity","`","times",".","The","reason","to","let","`","greater_than","`","as","true","by","default","is","that","tqdm","sometimes","displays","the","``","100","%","''","more","than","once","for","each","progress","bar","because","it","may","want","to","correct","its","estimation","of","it\/s",".","In","this","case",",","the","tqdm","could","remove","the","original","``","100","%","''","and","then","re-display","``","100","%","''","with","the","updated","estimate","of","it\/s","."]
code: def _check_error_msg_multiplicity(
      self,
      mock_stderr: io.StringIO,
      msg: str,
      msg_multiplicity: int,
      greater_than: bool = True,
  ):
      """
      Checks that in `mock_stderr`, the error msg `msg` occurs `msg_multiplicity`
      times. If 'greater_than' is true, it checks that the `msg` occurs at least
      `msg_multiplicity` times. Otherwise, it checks that `msg` occurs exactly
      `msg_multiplicity` times. The reason to let `greater_than` as true by default
      is that tqdm sometimes displays the "100%" more than once for each progress bar
      because it may want to correct its estimation of it/s. In this case, the
      tqdm could remove the original "100%" and then re-display "100%" with the
      updated estimate of it/s.
      """
      output = mock_stderr.getvalue()
      actual_msg_multiplicity = output.count(msg)
      assert isinstance(actual_msg_multiplicity, int)
      error_msg = (
          f"Error in progress of batches with output looking for '{msg}'"
          f" at least {msg_multiplicity} times"
          f"(found {actual_msg_multiplicity}) in {repr(output)}"
      )
      if greater_than:
          self.assertGreaterEqual(
              actual_msg_multiplicity, msg_multiplicity, error_msg
          )
      else:
          self.assertEqual(
              actual_msg_multiplicity,
              msg_multiplicity,
              error_msg,
          )
  
file_path: captum/tests/influence/_core/test_tracin_show_progress.py
imports: import io
  import tempfile
  import unittest
  import unittest.mock
  from typing import Callable
  import torch.nn
  from captum.influence._core.tracincp import TracInCP
  from captum.influence._core.tracincp_fast_rand_proj import TracInCPFast
  from parameterized import parameterized
  from tests.helpers.basic import BaseTest
  from tests.influence._utils.common import build_test_name_func, DataInfluenceConstructor, get_random_model_and_data
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 for calling the TestTracInShowProgress obj's underlying member method code with example usage: obj._check_error_msg_multiplicity(mock_stderr, msg, msg_multiplicity, greater_than) without return types