code: def test_optimize_acqf_homotopy_pruning(self, prune_candidates_mock):
      tkwargs = {"device": self.device, "dtype": torch.double}
      p = Parameter(torch.zeros(1, **tkwargs))
      hp = HomotopyParameter(
          parameter=p,
          schedule=LinearHomotopySchedule(start=4, end=0, num_steps=5),
      )
      model = GenericDeterministicModel(f=lambda x: 5 - (x - p) ** 2)
      acqf = PosteriorMean(model=model)
      candidate, acqf_val = optimize_acqf_homotopy(
          q=1,
          acq_function=acqf,
          bounds=torch.tensor([[-10], [5]]).to(**tkwargs),
          homotopy=Homotopy(homotopy_parameters=[hp]),
          num_restarts=4,
          raw_samples=16,
          post_processing_func=lambda x: x.round(),
      )
      # First time we expect to call `prune_candidates` with 4 candidates
      self.assertEqual(
          prune_candidates_mock.call_args_list[0][1][
              "candidates"
          ].shape,
          torch.Size([4, 1]),
      )
      for i in range(
          1, 5
      ):  # The paths should have been pruned to just one path
          self.assertEqual(
              prune_candidates_mock.call_args_list[i][1][
                  "candidates"
              ].shape,
              torch.Size([1, 1]),
          )
  
file_path: botorch/test/optim/test_homotopy.py
imports: import unittest.mock
  import torch
  from botorch.acquisition import PosteriorMean
  from botorch.acquisition.monte_carlo import qExpectedImprovement
  from botorch.models import GenericDeterministicModel
  from botorch.optim.homotopy import FixedHomotopySchedule, Homotopy, HomotopyParameter, LinearHomotopySchedule, LogLinearHomotopySchedule
  from botorch.optim.optimize_homotopy import optimize_acqf_homotopy, prune_candidates
  from botorch.utils.testing import BotorchTestCase
  from torch.nn import Parameter
label_desc: Use image node_id 8 for calling the TestHomotopy obj's underlying member method code with example usage: obj.test_optimize_acqf_homotopy_pruning(prune_candidates_mock) without return types