code: def test_max_configs():
      """
      Make sure that ASHA stops when done.
      """
      parameters = [sherpa.Continuous("myparam", [0, 1])]
  
      algorithm = successive_halving.SuccessiveHalving(
          r=1, R=9, eta=3, s=0, max_finished_configs=5
      )
  
      study = sherpa.Study(
          parameters=parameters,
          algorithm=algorithm,
          lower_is_better=False,
          disable_dashboard=True,
      )
  
      for trial in study:
          print(trial.id, trial.parameters)
  
          study.add_observation(
              trial=trial, iteration=1, objective=float(trial.id)
          )
          study.finalize(trial)
  
      completed = study.results.query("Status == 'COMPLETED'")
  
      assert len(completed.loc[completed.rung == 2, :]) == 5
  
file_path: sherpa/tests/test_successive_halving.py
imports: from __future__ import absolute_import
  import collections
  from sherpa.algorithms import successive_halving
  from testing_utils import *
label_desc: Use image node_id 4 for calling a global function with example usage: test_max_configs() without return types