class_docstr: Tests that dispatching utilities correctly select generation strategies.
code: def test_enforce_sequential_optimization(self) -> None:
      with self.subTest("True"):
          sobol_gpei = choose_generation_strategy(
              search_space=get_branin_search_space()
          )
          self.assertEqual(sobol_gpei._steps[0].num_trials, 5)
          self.assertTrue(sobol_gpei._steps[0].enforce_num_trials)
          self.assertIsNotNone(sobol_gpei._steps[1].max_parallelism)
      with self.subTest("False"):
          sobol_gpei = choose_generation_strategy(
              search_space=get_branin_search_space(),
              enforce_sequential_optimization=False,
          )
          self.assertEqual(sobol_gpei._steps[0].num_trials, 5)
          self.assertFalse(sobol_gpei._steps[0].enforce_num_trials)
          self.assertIsNone(sobol_gpei._steps[1].max_parallelism)
      with self.subTest("False and max_parallelism_override"):
          with self.assertLogs(
              choose_generation_strategy.__module__, logging.INFO
          ) as logger:
              choose_generation_strategy(
                  search_space=get_branin_search_space(),
                  enforce_sequential_optimization=False,
                  max_parallelism_override=5,
              )
              self.assertTrue(
                  any(
                      "other max parallelism settings will be ignored"
                      in output
                      for output in logger.output
                  ),
                  logger.output,
              )
      with self.subTest("False and max_parallelism_cap"):
          with self.assertLogs(
              choose_generation_strategy.__module__, logging.INFO
          ) as logger:
              choose_generation_strategy(
                  search_space=get_branin_search_space(),
                  enforce_sequential_optimization=False,
                  max_parallelism_cap=5,
              )
              self.assertTrue(
                  any(
                      "other max parallelism settings will be ignored"
                      in output
                      for output in logger.output
                  ),
                  logger.output,
              )
      with self.subTest(
          "False and max_parallelism_override and max_parallelism_cap"
      ):
          with self.assertRaisesRegex(
              ValueError,
              (
                  "If `max_parallelism_override` specified, cannot also apply "
                  "`max_parallelism_cap`."
              ),
          ):
              choose_generation_strategy(
                  search_space=get_branin_search_space(),
                  enforce_sequential_optimization=False,
                  max_parallelism_override=5,
                  max_parallelism_cap=5,
              )
  
imports: import logging
  import warnings
  from typing import Any, Dict
  import torch
  from ax.core.objective import MultiObjective
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig
  from ax.modelbridge.dispatch_utils import _make_botorch_step, calculate_num_initialization_trials, choose_generation_strategy, DEFAULT_BAYESIAN_PARALLELISM
  from ax.modelbridge.factory import Cont_X_trans, Y_trans
  from ax.modelbridge.registry import Mixed_transforms, Models
  from ax.modelbridge.transforms.log_y import LogY
  from ax.modelbridge.transforms.winsorize import Winsorize
  from ax.models.winsorization_config import WinsorizationConfig
  from ax.utils.common.testutils import TestCase
  from ax.utils.common.typeutils import not_none
  from ax.utils.testing.core_stubs import get_branin_search_space, get_discrete_search_space, get_experiment, get_factorial_search_space, get_large_factorial_search_space, get_large_ordinal_search_space, get_search_space_with_choice_parameters, run_branin_experiment_with_generation_strategy
  from ax.utils.testing.mock import fast_botorch_optimize
label_desc: Use image node_id 6 for calling the TestDispatchUtils obj's underlying member method code with example usage: obj.test_enforce_sequential_optimization() without return types