class_docstr: Test suite for algorithm MOFA
class_docstr_tok: ["Test","suite","for","algorithm","MOFA"]
docstr: Test that algorithm will stop when cardinality is reached
docstr_tok: ["Test","that","algorithm","will","stop","when","cardinality","is","reached"]
code: def test_is_done_cardinality(self):
      """Test that algorithm will stop when cardinality is reached"""
      space = self.update_space(
          {
              "x": "uniform(0, 4, discrete=True)",
              "y": "choices(['a', 'b', 'c'])",
              "z": "loguniform(1, 6, discrete=True)",
          }
      )
      space = self.create_space(space)
      assert space.cardinality == 5 * 3 * 6
  
      algo = self.create_algo(
          space=space, index=320, n_levels=2, strength=2
      )
      trials = []
      for i in range(space.cardinality):
          suggested_trials = algo.suggest(1)
          if not suggested_trials:
              continue
          trial = suggested_trials[0]
          trial.results.append(
              trial.Result(name="objective", value=i, type="objective")
          )
          trial.status = "completed"
          algo.observe([trial])
          trials.append(trial)
          if algo.is_done:
              break
  
      assert algo.is_done
      assert len(trials) == space.cardinality
  
file_path: orion/tests/unittests/algo/mofa/test_mofa.py
imports: from __future__ import annotations
  from typing import ClassVar
  import pytest
  import scipy
  from packaging import version
  from orion.algo.mofa.mofa import MOFA
  from orion.algo.space import Space
  from orion.testing.algo import BaseAlgoTests, TestPhase
label_desc: Use image node_id 9 for calling the TestMOFA obj's underlying member method code with example usage: obj.test_is_done_cardinality() without return types