class_docstr: `CompletionCriterion` is deprecrated and replaced by `TransitionCriterion`.
  However, some legacy code still depends on the skelton implementation of
  `CompletionCriterion`, so we will keep this test case until full reaping.
class_docstr_tok: ["`","CompletionCriterion","`","is","deprecrated","and","replaced","by","`","TransitionCriterion","`",".","However",",","some","legacy","code","still","depends","on","the","skelton","implementation","of","`","CompletionCriterion","`",",","so","we","will","keep","this","test","case","until","full","reaping","."]
code: def test_single_criterion(self) -> None:
      criterion = MinimumPreferenceOccurances(
          metric_name="m1", threshold=3
      )
  
      experiment = get_experiment()
  
      generation_strategy = GenerationStrategy(
          name="SOBOL+GPEI::default",
          steps=[
              GenerationStep(
                  model=Models.SOBOL,
                  num_trials=-1,
                  completion_criteria=[criterion],
              ),
              GenerationStep(
                  model=Models.GPEI,
                  num_trials=-1,
                  max_parallelism=1,
              ),
          ],
      )
      generation_strategy.experiment = experiment
  
      # Has not seen enough of each preference
      self.assertFalse(
          generation_strategy._maybe_move_to_next_step(
              raise_data_required_error=False
          )
      )
  
      data = Data(
          df=pd.DataFrame(
              {
                  "trial_index": range(6),
                  "arm_name": [f"{i}_0" for i in range(6)],
                  "metric_name": ["m1" for _ in range(6)],
                  "mean": [0, 0, 0, 1, 1, 1],
                  "sem": [0 for _ in range(6)],
              }
          )
      )
      with patch.object(experiment, "fetch_data", return_value=data):
          # We have seen three "yes" and three "no"
          self.assertTrue(
              generation_strategy._maybe_move_to_next_step(
                  raise_data_required_error=False
              )
          )
  
          self.assertEqual(
              generation_strategy._curr.model_enum, Models.GPEI
          )
  
file_path: Ax/ax/modelbridge/tests/test_completion_criterion.py
imports: from unittest.mock import patch
  import pandas
  from ax.core.base_trial import TrialStatus
  from ax.core.data import Data
  from ax.modelbridge.completion_criterion import MinimumPreferenceOccurances, MinimumTrialsInStatus
  from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
  from ax.modelbridge.registry import Models
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.core_stubs import get_experiment
label_desc: Use image node_id 1 for calling the TestCompletionCritereon obj's underlying member method code with example usage: obj.test_single_criterion() without return types