code: def test_basic_variant_limiter():
      search_alg = BasicVariantGenerator(max_concurrent=2)
  
      experiment_spec = {
          "run": "__fake",
          "num_samples": 5,
          "stop": {"training_iteration": 1},
      }
      search_alg.add_configurations({"test": experiment_spec})
  
      trial1 = search_alg.next_trial()
      assert trial1
  
      trial2 = search_alg.next_trial()
      assert trial2
  
      # Returns None because of limiting
      trial3 = search_alg.next_trial()
      assert not trial3
  
      # Finish trial, now trial 3 should be created
      search_alg.on_trial_complete(trial1.trial_id, None, False)
      trial3 = search_alg.next_trial()
      assert trial3
  
      trial4 = search_alg.next_trial()
      assert not trial4
  
      search_alg.on_trial_complete(trial2.trial_id, None, False)
      search_alg.on_trial_complete(trial3.trial_id, None, False)
  
      trial4 = search_alg.next_trial()
      assert trial4
  
      trial5 = search_alg.next_trial()
      assert trial5
  
      search_alg.on_trial_complete(trial4.trial_id, None, False)
  
      # Should also be None because search is finished
      trial6 = search_alg.next_trial()
      assert not trial6
  
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 8 for calling a global function with example usage: test_basic_variant_limiter() without return types