code: def test_incumbent_selection_single_objective(
      make_scenario, configspace_small, make_config_selector
  ):
      """Tests whether the incumbents are updated as expected."""
  
      scenario = make_scenario(
          configspace_small, use_instances=True, n_instances=3
      )
      runhistory = RunHistory()
      intensifier = Intensifier(
          scenario=scenario, max_config_calls=10, seed=0
      )
      intensifier.config_selector = make_config_selector(
          scenario, runhistory
      )
      intensifier.runhistory = runhistory
  
      config = configspace_small.get_default_configuration()
      config2 = configspace_small.sample_configuration(1)
  
      runhistory.add(
          config=config,
          cost=50,
          time=0.0,
          instance=scenario.instances[0],
          seed=999,
      )
      intensifier.update_incumbents(config)
      assert intensifier.get_incumbent() == config
  
      # If we add the same config with another instance, nothing should change
      runhistory.add(
          config=config,
          cost=50,
          time=0.0,
          instance=scenario.instances[1],
          seed=999,
      )
      intensifier.update_incumbents(config)
      assert intensifier.get_incumbent() == config
  
      # Now we add another config, however, it is only evaluated on the first instance
      # So the incumbent should not have changed
      runhistory.add(
          config=config2,
          cost=40,
          time=0.0,
          instance=scenario.instances[0],
          seed=999,
      )
      intensifier.update_incumbents(config2)
      assert intensifier.get_incumbent() == config
  
      # Now we add the next trial, then it should change
      runhistory.add(
          config=config2,
          cost=40,
          time=0.0,
          instance=scenario.instances[1],
          seed=999,
      )
      intensifier.update_incumbents(config2)
      assert intensifier.get_incumbent() == config2
  
file_path: SMAC3/tests/test_intensifier/test_abstract_intensifier.py
imports: import random
  import pytest
  from smac.initial_design.random_design import RandomInitialDesign
  from smac.intensifier.abstract_intensifier import AbstractIntensifier
  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 2 for calling a global function with example usage: test_incumbent_selection_single_objective(make_scenario, configspace_small, make_config_selector) without return types