docstr: Test that when exploit returns another trial, the base one is reused and case of
  duplicate samples
docstr_tok: ["Test","that","when","exploit","returns","another","trial",",","the","base","one","is","reused","and","case","of","duplicate","samples"]
code: def test_generate_offspring_retry_using_same_trial(
      self,
      space: Space,
      caplog: pytest.LogCaptureFixture,
  ):
      """Test that when exploit returns another trial, the base one is reused and case of
      duplicate samples
      """
      pbt = _create_algo(
          space,
          exploit=ExploitStub(
              rval="toset", should_receive="toset"
          ).configuration,
          explore=ExploreStub(rval="toset").configuration,
          fork_timeout=0.0001,
      ).unwrap(PBT)
  
      trials = sample_trials(
          pbt.space, 3, status="completed", objective=1
      )
      parent_trial = trials[0]
      base_trial = trials[1]
      sample_params = trials[2].params
  
      pbt.exploit_func.rval = parent_trial
      pbt.exploit_func.should_receive = base_trial
      pbt.explore_func.rval = sample_params
  
      pbt.register(parent_trial)
      pbt.register(base_trial)
  
      # The trial sampled will already be registered
      sample_params["f"] = pbt.fidelities[space["f"].low]
      child = parent_trial.branch(params=sample_params)
      pbt.register(child)
  
      # Exploit will return parent_trial, but Explore will return params of child, sampling
      # a duplite, since child is already registered. ExploitStub.should_receive will
      # test that base_trial is passed as expected to exploit when attempting more attempts
      # of exploit and explore.
      with caplog.at_level(logging.INFO):
          trial_to_branch, new_trial = pbt._generate_offspring(
              base_trial
          )
  
      assert (
          "Could not generate unique new parameters"
          in caplog.records[-1].message
      )
      assert trial_to_branch is None
      assert new_trial is None
  
imports: from __future__ import annotations
  import functools
  import logging
  from typing import ClassVar
  import numpy
  import pytest
  from base import ExploitStub, ExploreStub, sample_trials
  from pytest_mock import MockerFixture
  from orion.algo.pbt.pbt import PBT, compute_fidelities
  from orion.algo.space import Space
  from orion.core.worker.primary_algo import SpaceTransform, create_algo
  from orion.core.worker.transformer import ReshapedSpace, TransformedSpace
  from orion.core.worker.trial import Trial
  from orion.testing.algo import BaseAlgoTests, TestPhase
label_desc: Use image node_id 6 for calling the TestPBTSuggest obj's underlying member method code with example usage: obj.test_generate_offspring_retry_using_same_trial(space, caplog) without return types