docstr: Tests the min_trials mechanism of the stopping strategy; that is,
  the stopping strategy should not take effect before min_trials trials
  are completed.
docstr_tok: ["Tests","the","min_trials","mechanism","of","the","stopping","strategy",";","that","is",",","the","stopping","strategy","should","not","take","effect","before","min_trials","trials","are","completed","."]
code: def test_min_trials(self) -> None:
      """
      Tests the min_trials mechanism of the stopping strategy; that is,
      the stopping strategy should not take effect before min_trials trials
      are completed.
      """
      global_stopping_strategy = DummyGlobalStoppingStrategy(
          min_trials=3, trial_to_stop=2
      )
      ax_client = self.get_ax_client_for_branin(
          global_stopping_strategy=global_stopping_strategy
      )
  
      # Running the first 2 iterations.
      for _ in range(2):
          parameters, trial_index = ax_client.get_next_trial()
          ax_client.complete_trial(
              trial_index=trial_index,
              # pyre-fixme[6]: For 2nd param expected `Union[Dict[str, Union[Tuple[...
              raw_data=self.evaluate(parameters),
          )
  
      # Since min_trials=3, GSS should not stop creating the 3rd iteration.
      parameters, trial_index = ax_client.get_next_trial()
      ax_client.complete_trial(
          trial_index=trial_index,
          # pyre-fixme[6]: For 2nd param expected `Union[Dict[str, Union[Tuple[Unio...
          raw_data=self.evaluate(parameters),
      )
      self.assertIsNotNone(parameters)
  
      # Now, GSS should stop creating the 4th iteration.
      exception = OptimizationShouldStop(
          message="Stop the optimization."
      )
      with self.assertRaises(OptimizationShouldStop) as cm:
          parameters, trial_index = ax_client.get_next_trial()
      # Assert Exception's message is unchanged.
      self.assertEqual(cm.exception.message, exception.message)
  
file_path: Ax/ax/service/tests/test_global_stopping.py
imports: from typing import Dict, Tuple
  import numpy
  from ax.core.types import TParameterization
  from ax.exceptions.core import OptimizationShouldStop
  from ax.global_stopping.strategies.base import BaseGlobalStoppingStrategy
  from ax.service.ax_client import AxClient
  from ax.utils.common.testutils import TestCase
  from ax.utils.measurement.synthetic_functions import branin
  from ax.utils.testing.core_stubs import DummyGlobalStoppingStrategy
label_desc: Use image node_id 4 for calling the TestGlobalStoppingIntegration obj's underlying member method code with example usage: obj.test_min_trials() without return types