code: def test_next_trials_counter(
      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__()
      config = configspace_small.get_default_configuration()
  
      # All good here
      trials = intensifier._get_next_trials(config, N=5)
      assert len(trials) == 5
  
      # But now we set a trial running
      runhistory.add_running_trial(trials[0])
  
      # Now we call the same thing again but expect 4 trials instead
      trials = intensifier._get_next_trials(config, N=5)
      assert len(trials) == 4
  
      # More interesting case: Use ``from_keys`` too
      instances = []
      for trial in trials:
          instances.append(trial.get_instance_seed_budget_key())
  
      # We have three instances now ...
      del instances[0]
  
      # ... but request 8
      trials = intensifier._get_next_trials(
          config, N=8, from_keys=instances
      )
      assert len(trials) == 3
  
      # ... but request 2
      trials = intensifier._get_next_trials(
          config, N=2, from_keys=instances
      )
      assert len(trials) == 2
  
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 3 for calling a global function with example usage: test_next_trials_counter(make_scenario, configspace_small, make_config_selector) without return types