class_docstr: Tests for the AlgoWrapper that makes suggest try repeatedly until a new trial is returned.
class_docstr_tok: ["Tests","for","the","AlgoWrapper","that","makes","suggest","try","repeatedly","until","a","new","trial","is","returned","."]
docstr: Test that when the algo can't produce a new trial, and there is no InsistWrapper, the
  SpaceTransform wrapper fails to sample a new trial.
docstr_tok: ["Test","that","when","the","algo","ca","n't","produce","a","new","trial",",","and","there","is","no","InsistWrapper",",","the","SpaceTransform","wrapper","fails","to","sample","a","new","trial","."]
code: def test_doesnt_insists_without_wrapper(
      self,
      algo_wrapper: InsistSuggest[FixedSuggestionAlgo],
      monkeypatch: MonkeyPatch,
  ):
      """Test that when the algo can't produce a new trial, and there is no InsistWrapper, the
      SpaceTransform wrapper fails to sample a new trial.
      """
      algo_without_wrapper = algo_wrapper.algorithm
      assert isinstance(algo_without_wrapper, FixedSuggestionAlgo)
      calls: int = 0
      # Make the wrapper insist enough so that it actually
      # gets a trial after asking enough times:
      fixed_suggestion = algo_without_wrapper.space.sample(1)[0]
  
      def _suggest(num: int) -> list[Trial]:
          nonlocal calls
          calls += 1
          if calls < 5:
              return []
          return [fixed_suggestion]
  
      monkeypatch.setattr(algo_without_wrapper, "suggest", _suggest)
      trials = algo_without_wrapper.suggest(1)
      assert calls == 1
      assert not trials
  
file_path: orion/tests/unittests/core/worker/algo_wrappers/test_insist_suggest.py
imports: from __future__ import annotations
  import logging
  from typing import ClassVar
  import pytest
  from pytest import MonkeyPatch
  from orion.algo.random import Random
  from orion.core.io.space_builder import SpaceBuilder
  from orion.core.worker.algo_wrappers import InsistSuggest
  from orion.core.worker.trial import Trial
  from .base import AlgoWrapperTests
  from .test_transform import FixedSuggestionAlgo
label_desc: Use image node_id 1 for calling the TestInsistSuggestWrapper obj's underlying member method code with example usage: obj.test_doesnt_insists_without_wrapper(algo_wrapper, monkeypatch) and returns: list, list