code: def test__filter_kwargs(self) -> None:
      def mock_adam(params, lr: float = 0.001) -> None:
          return  # pragma: nocover
  
      kwargs = {"lr": 0.01, "maxiter": 3000}
      expected_msg = (
          r"Keyword arguments \['maxiter'\] will be ignored because they are "
          r"not allowed parameters for function mock_adam. Allowed parameters "
          r"are \['params', 'lr'\]."
      )
  
      with self.assertWarnsRegex(Warning, expected_msg):
          valid_kwargs = _filter_kwargs(mock_adam, **kwargs)
      self.assertEqual(set(valid_kwargs.keys()), {"lr"})
  
      mock_partial = partial(mock_adam, lr=2.0)
      expected_msg = (
          r"Keyword arguments \['maxiter'\] will be ignored because they are "
          r"not allowed parameters. Allowed parameters are \['params', 'lr'\]."
      )
      with self.assertWarnsRegex(Warning, expected_msg):
          valid_kwargs = _filter_kwargs(mock_partial, **kwargs)
      self.assertEqual(set(valid_kwargs.keys()), {"lr"})
  
file_path: botorch/test/optim/utils/test_common.py
imports: from __future__ import annotations
  from functools import partial
  from warnings import catch_warnings, warn
  import numpy
  from botorch.optim.utils import _filter_kwargs, _handle_numerical_errors, _warning_handler_template
  from botorch.utils.testing import BotorchTestCase
  from linear_operator.utils.errors import NanError, NotPSDError
label_desc: Use image node_id 1 for calling the TestUtilsCommon obj's underlying member method code with example usage: obj.test__filter_kwargs() without return types