code: def test_is_done_max_trials(monkeypatch, dumbalgo):
      """Check whether algorithm will stop with base algorithm max_trials check"""
      monkeypatch.delattr(dumbalgo, "is_done")
  
      space = Space()
      space.register(Real("yolo1", "uniform", 1, 4))
  
      algo = dumbalgo(space)
      algo.suggest(5)
      for i in range(1, 5):
          backward.algo_observe(
              algo,
              [format_trials.tuple_to_trial((i,), space)],
              [dict(objective=3)],
          )
  
      assert len(algo.state_dict["registry"]["_trials"]) == 4
      assert not algo.is_done
  
      dumbalgo.max_trials = 4
      assert algo.is_done
  
file_path: orion/tests/unittests/algo/test_base.py
imports: import pytest
  from orion.algo.base import BaseAlgorithm
  from orion.algo.space import Integer, Real, Space
  from orion.core.utils import backward, format_trials
label_desc: Use image node_id 5 for calling a global function with example usage: test_is_done_max_trials(monkeypatch, dumbalgo) without return types