class_docstr: Tests for the algo Hyperband.
class_docstr_tok: ["Tests","for","the","algo","Hyperband","."]
docstr: Test that identic objectives are handled properly
docstr_tok: ["Test","that","identic","objectives","are","handled","properly"]
code: def test_suggest_promote_identic_objectives(
      self, hyperband: Hyperband, bracket: HyperbandBracket
  ):
      """Test that identic objectives are handled properly"""
      hyperband.brackets = [bracket]
      assert bracket.owner is hyperband
  
      n_trials = 9
      resources = 1
  
      results = {}
      for param in np.linspace(0, 8, 9):
          trial = create_trial_for_hb((resources, param), objective=0)
          trial_hash = trial.compute_trial_hash(
              trial,
              ignore_fidelity=True,
          )
          assert trial.objective is not None
          results[trial_hash] = (trial.objective.value, trial)
  
      bracket.rungs[0] = RungDict(
          n_trials=n_trials, resources=resources, results=results
      )
  
      candidates = hyperband.suggest(2)
      assert candidates is not None
      assert len(candidates) == 2
      assert (
          sum(
              1
              for trial in candidates
              if trial.params[hyperband.fidelity_index] == 3
          )
          == 2
      )
  
imports: from __future__ import annotations
  import copy
  import logging
  import typing
  from typing import Any, ClassVar, Sequence
  import numpy
  import pytest
  from orion.algo.hyperband import BudgetTuple, Hyperband, HyperbandBracket, RungDict, compute_budgets
  from orion.algo.space import Fidelity, Integer, Real, Space
  from orion.core.utils.flatten import flatten
  from orion.core.worker.primary_algo import SpaceTransform
  from orion.core.worker.trial import Trial
  from orion.testing.algo import BaseAlgoTests, TestPhase
  from orion.testing.trial import compare_trials, create_trial
label_desc: Use image node_id 14 for calling the TestHyperband obj's underlying member method code with example usage: obj.test_suggest_promote_identic_objectives(hyperband, bracket) without return types