code: def test_set_max_concurrency():
      """Test whether ``set_max_concurrency`` is called by the
      ``ConcurrencyLimiter`` and works correctly.
      """
  
      class TestSuggestion(Searcher):
          def __init__(self, index):
              self.index = index
              self.returned_result = []
              self._max_concurrent = 1
              super().__init__(metric="result", mode="max")
  
          def suggest(self, trial_id):
              self.index += 1
              return {"score": self.index}
  
          def on_trial_complete(self, trial_id, result=None, **kwargs):
              self.returned_result.append(result)
  
          def set_max_concurrency(self, max_concurrent: int) -> bool:
              self._max_concurrent = max_concurrent
              return True
  
      searcher = TestSuggestion(0)
      limiter_max_concurrent = 2
      limiter = ConcurrencyLimiter(
          searcher, max_concurrent=limiter_max_concurrent, batch=True
      )
      assert limiter.searcher._max_concurrent == limiter_max_concurrent
      # Since set_max_concurrency returns True, ConcurrencyLimiter should not
      # be limiting concurrency itself
      assert not limiter._limit_concurrency
      assert limiter.suggest("test_1")["score"] == 1
      assert limiter.suggest("test_2")["score"] == 2
      assert limiter.suggest("test_3")["score"] == 3
  
file_path: ray/python/ray/tune/tests/test_searcher_utils.py
imports: import pytest
  from ray.tune.search import BasicVariantGenerator
  from ray.tune.search.repeater import Repeater
  from ray.tune.search import Searcher, ConcurrencyLimiter
  from ray.tune.search.search_generator import SearchGenerator
label_desc: Use image node_id 11 for calling a global function with example usage: test_set_max_concurrency() and returns: dict, True