code: def test_chain():
      parameters = [
          sherpa.Continuous("a", [0, 1]),
          sherpa.Choice("b", ["x", "y", "z"]),
      ]
      algorithm = sherpa.algorithms.Chain(
          algorithms=[
              sherpa.algorithms.GridSearch(num_grid_points=2),
              sherpa.algorithms.RandomSearch(max_num_trials=10),
          ]
      )
      study = sherpa.Study(
          parameters=parameters,
          algorithm=algorithm,
          lower_is_better=True,
          disable_dashboard=True,
      )
  
      for trial in study:
          if trial.id < 7:
              assert trial.parameters["a"] in [0, 1]
              assert (
                  trial.parameters["b"]
                  == ["x", "y", "z"][trial.id % 3 - 1]
              )
          else:
              assert trial.parameters["a"] not in [0, 1]
  
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 18 for calling a global function with example usage: test_chain() without return types