code: def test_next_trials(
      make_scenario, configspace_small, make_config_selector
  ):
      """Tests whether the next trials are as expected."""
  
      scenario = make_scenario(
          configspace_small, use_instances=True, n_instances=3
      )
      runhistory = RunHistory()
      intensifier = Intensifier(
          scenario=scenario, max_config_calls=9, seed=0
      )
      intensifier.config_selector = make_config_selector(
          scenario, runhistory
      )
      intensifier.runhistory = runhistory
      intensifier.__post_init__()
  
      # If we don't specify N we expect max config call trials here
      trials = intensifier._get_next_trials(None)
      assert len(trials) == 9
  
      trials = intensifier._get_next_trials(None, N=3)
      assert len(trials) == 3
  
      trials = intensifier._get_next_trials(None, N=141)
      assert len(trials) == 9
  
      # Now we want to test if the shuffling works as expected
      # Since we group the trials by seed, we expect the first 3 trials to have the same seed
      seed_changes = 0
      previous_seed = None
      for trial in trials:
          if trial.seed != previous_seed:
              seed_changes += 1
              previous_seed = trial.seed
  
      assert seed_changes == 3
  
      # Next, we want to check if evaluated trials are removed
      config = configspace_small.get_default_configuration()
      runhistory.add(
          config=config,
          cost=0.5,
          time=0.0,
          instance=trials[0].instance,
          seed=trials[0].seed,
      )
  
      trials = intensifier._get_next_trials(config)
      assert len(trials) == 8
  
      # And if we add a running trial?
      runhistory.add(
          config=config,
          cost=0.5,
          time=0.0,
          instance=trials[0].instance,
          seed=trials[0].seed,
          status=StatusType.RUNNING,
      )
  
      trials = intensifier._get_next_trials(config)
      assert len(trials) == 7
  
      # The only thing missing is ``from_keys`` now
      isbk = trials[0].get_instance_seed_budget_key()
  
      trials = intensifier._get_next_trials(config, from_keys=[isbk])
      assert len(trials) == 1
      assert trials[0].instance == isbk.instance
      assert trials[0].seed == isbk.seed
  
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 2 for calling a global function with example usage: test_next_trials(make_scenario, configspace_small, make_config_selector) without return types