class_docstr: Tests for the algo ASHA.
class_docstr_tok: ["Tests","for","the","algo","ASHA","."]
docstr: Test that sampling collisions are handled.
code: def test_suggest_duplicates(
      self,
      monkeypatch,
      asha: ASHA,
      bracket: ASHABracket,
      rung_0: RungDict,
      rung_1: RungDict,
      rung_2: RungDict,
  ):
      """Test that sampling collisions are handled."""
      asha.brackets = [bracket]
      assert bracket.owner is asha
  
      fidelity = 1
      duplicate_trial = create_trial_for_hb((fidelity, 0.0))
      new_trial = create_trial_for_hb((fidelity, 0.5))
  
      duplicate_id_wo_fidelity = asha.get_id(
          duplicate_trial, ignore_fidelity=True
      )
      bracket.rungs[0] = dict(
          n_trials=2,
          resources=1,
          results={duplicate_id_wo_fidelity: (0.0, duplicate_trial)},
      )
      asha.trial_to_brackets[duplicate_id_wo_fidelity] = 0
  
      asha.register(duplicate_trial)
  
      trials = [duplicate_trial, new_trial]
  
      def sample(num=1, seed=None):
          return trials
  
      monkeypatch.setattr(asha.space, "sample", sample)
  
      assert asha.suggest(1)[0].params == new_trial.params
  
imports: from __future__ import annotations
  import hashlib
  import logging
  from typing import ClassVar
  import numpy
  import pytest
  from test_hyperband import compare_registered_trial, create_rung_from_points, create_trial_for_hb, force_observe
  from orion.algo.asha import ASHA, ASHABracket, compute_budgets
  from orion.algo.hyperband import RungDict
  from orion.algo.space import Fidelity, Integer, Real, Space
  from orion.core.worker.primary_algo import SpaceTransform
  from orion.testing.algo import BaseAlgoTests, TestPhase
  from orion.testing.trial import create_trial
label_desc: Use image node_id 8 for calling the TestASHA obj's underlying member method code with example usage: obj.test_suggest_duplicates(monkeypatch, asha, bracket, rung_0, rung_1, rung_2) and returns: trials