code: def test_promoting(
      make_scenario, configspace_small, make_config_selector
  ):
      """Tests whether an evaluated batch is promoted correctly."""
      max_budget = 3
      scenario: Scenario = make_scenario(
          configspace_small,
          use_instances=False,
          min_budget=1,
          max_budget=max_budget,
      )
      runhistory = RunHistory()
      intensifier = SuccessiveHalving(scenario=scenario)
      intensifier.config_selector = make_config_selector(
          scenario, runhistory, n_initial_configs=1
      )
      intensifier.runhistory = runhistory
      intensifier.__post_init__()
  
      n_configs = intensifier._n_configs_in_stage
      budgets = intensifier._budgets_in_stage
  
      assert n_configs[0] == [3, 1]
      assert budgets[0] == [1.0, 3.0]
  
      gen = iter(intensifier)
      for i in range(n_configs[0][0]):
          trial = next(gen)
          assert trial.budget == budgets[0][0]
          runhistory.add(
              config=trial.config,
              cost=i,
              time=0.0,
              instance=trial.instance,
              seed=trial.seed,
              budget=trial.budget,
              status=StatusType.SUCCESS,
          )
  
          assert (0, 1) not in intensifier._tracker
  
      # Now we should trigger the next stage
      trial = next(gen)
      runhistory.add_running_trial(trial)
      assert (0, 1) in intensifier._tracker
  
      # There should be only one batch
      assert len(intensifier._tracker[(0, 1)]) == 1
  
      # There should be only one configuration inside this batch
      assert len(intensifier._tracker[(0, 1)][0][1]) == n_configs[0][1]
  
      # And the next trial should have the highest budget
      assert trial.budget == budgets[0][1]
  
      # If we would call next(gen) again we expect a new batch in the first stage
      first_stage_trial = next(gen)
      assert first_stage_trial.budget == budgets[0][0]
  
      # Now we mark the previous trial as finished
      runhistory.add(
          config=trial.config,
          cost=i,
          time=0.0,
          instance=trial.instance,
          seed=trial.seed,
          budget=trial.budget,
      )
  
      # If we call next(gen) again, we expect no entries in the second stage anymore
      assert len(intensifier._tracker[(0, 1)]) == 0
      assert (0, 2) not in intensifier._tracker
  
      # However, the first batch should still be there
      assert len(intensifier._tracker[(0, 0)]) == 1
      assert len(intensifier._tracker[(0, 0)][0][1]) == n_configs[0][0]
  
file_path: SMAC3/tests/test_intensifier/test_successive_halving.py
imports: import pytest
  from smac.initial_design.random_design import RandomInitialDesign
  from smac.intensifier.successive_halving import SuccessiveHalving
  from smac.main.config_selector import ConfigSelector
  from smac.runhistory.dataclasses import InstanceSeedBudgetKey
  from smac.runhistory.enumerations import StatusType
  from smac.runhistory.runhistory import RunHistory
  from smac.scenario import Scenario
label_desc: Use image node_id 12 for calling a global function with example usage: test_promoting(make_scenario, configspace_small, make_config_selector) without return types