code: def test_repeat_wait_for_completion():
      parameters = [
          sherpa.Continuous("a", [0, 1]),
          sherpa.Choice("b", ["x", "y", "z"]),
      ]
      rs = sherpa.algorithms.RandomSearch(max_num_trials=10)
      rs = sherpa.algorithms.Repeat(
          algorithm=rs, num_times=10, wait_for_completion=True
      )
      study = sherpa.Study(
          parameters=parameters,
          algorithm=rs,
          lower_is_better=True,
          disable_dashboard=True,
      )
  
      for i in range(10):
          tnew = study.get_suggestion()
          print(tnew.parameters)
          assert isinstance(tnew.parameters, dict)
          config = tnew.parameters
          study.add_observation(tnew, objective=float(i), iteration=1)
          study.finalize(tnew)
  
          for j in range(9):
              t = study.get_suggestion()
              config_repeat = t.parameters
              assert config == config_repeat
  
              if j < 8:
                  study.add_observation(
                      t, objective=float(i), iteration=1
                  )
                  study.finalize(t)
  
          # Obtained 10/10 repeats for the configuration, but haven't added
          # results for the last one. Obtaining a new suggestion we expect WAIT.
          twait = study.get_suggestion()
          assert twait == sherpa.AlgorithmState.WAIT
          study.add_observation(t, objective=float(i), iteration=1)
          study.finalize(t)
  
      tdone = study.get_suggestion()
      assert tdone == sherpa.AlgorithmState.DONE
  
imports: from __future__ import absolute_import
  import collections
  import pandas
  import numpy
  import sherpa
  import logging
  import itertools
  import pytest
  from testing_utils import *
label_desc: Use image node_id 13 for calling a global function with example usage: test_repeat_wait_for_completion() without return types