code: def test_get_constants_like(self):
      def mock_get_constants(values: torch.Tensor, **kwargs):
          return kwargs
  
      tkwargs = {"device": self.device, "dtype": torch.float16}
      with patch.object(
          constants, "get_constants", new=mock_get_constants
      ):
          ref = torch.tensor([123], **tkwargs)
          other = constants.get_constants_like(0.123, ref=ref)
          self.assertEqual(other["device"].type, tkwargs["device"].type)
          self.assertEqual(other["dtype"], tkwargs["dtype"])
  
file_path: botorch/test/utils/test_constants.py
imports: from __future__ import annotations
  from unittest.mock import patch
  import torch
  from botorch.utils import constants
  from botorch.utils.testing import BotorchTestCase
label_desc: Use image node_id 2 for calling the TestConstants obj's underlying member method code with example usage: obj.test_get_constants_like() and returns: kwargs