code: def test_intensifier(
      make_scenario, configspace_small, make_config_selector
  ):
      """Tests whether the generator returns trials as expected."""
      scenario = make_scenario(
          configspace_small, use_instances=True, n_instances=3
      )
      runhistory = RunHistory()
      intensifier = Intensifier(
          scenario=scenario, max_config_calls=3, seed=0
      )
      intensifier.config_selector = make_config_selector(
          scenario, runhistory, n_initial_configs=1
      )
      intensifier.runhistory = runhistory
  
      gen = iter(intensifier)
  
      # Because queue is empty and we don't have any incumbents yet, we expect the first trial
      # to be the config from the random initial design
      trial = next(gen)
      runhistory.add_running_trial(
          trial
      )  # We have to mark it as running manually
      intensifier.update_incumbents(trial.config)
      assert (
          intensifier.config_selector._initial_design_configs[0]
          == trial.config
      )
  
      # In the next step, (config, N*2) is added to the queue but the intensifier realizes
      # that the previous trial is still running
      # Therefore, we expect to sample a new configuration as there are still no incumbents available
      # (not evaluated yet)
      trial2 = next(gen)
      runhistory.add_running_trial(trial2)
      intensifier.update_incumbents(trial2.config)
      assert (
          intensifier.config_selector._processed_configs[1]
          == trial2.config
      )
  
      # Let's mark the first trial as finished
      # The config should become an incumbent now.
      runhistory.add(
          config=trial.config,
          cost=10,
          time=0.0,
          instance=trial.instance,
          seed=trial.seed,
          force_update=True,
      )
      intensifier.update_incumbents(trial.config)
      assert intensifier.get_incumbent() == trial.config
  
      # Since everything in the queue is running, we start to intensify the incumbent
      trial3 = next(gen)
      runhistory.add_running_trial(trial3)
      intensifier.update_incumbents(trial3.config)
      assert trial3.config == trial.config
  
      # And we expect a new config again (after incumbent intensification)
      trial4 = next(gen)
      runhistory.add_running_trial(trial4)
      intensifier.update_incumbents(trial4.config)
      assert (
          intensifier.config_selector._processed_configs[2]
          == trial4.config
      )
  
file_path: SMAC3/tests/test_intensifier/test_intensifier.py
imports: from smac.initial_design.random_design import RandomInitialDesign
  from smac.intensifier.intensifier import Intensifier
  from smac.main.config_selector import ConfigSelector
  from smac.runhistory.enumerations import StatusType
  from smac.runhistory.runhistory import RunHistory
  from smac.scenario import Scenario
label_desc: Use image node_id 4 for calling a global function with example usage: test_intensifier(make_scenario, configspace_small, make_config_selector) without return types