class_docstr: Tests keywords, multiple arguments, and non-training arguments in relevant optimizers
docstr: Test that the keywords get passed and alter the function
docstr_tok: ["Test","that","the","keywords","get","passed","and","alter","the","function"]
code: def test_kwargs(self, mocker, opt, opt_name, tol):
      """Test that the keywords get passed and alter the function"""
  
      class func_wrapper:
          @staticmethod
          def func(x, c=1.0):
              return (x - c) ** 2
  
      x = np.array(1.0, requires_grad=True)
  
      wrapper = func_wrapper()
      spy = mocker.spy(wrapper, "func")
  
      _ = opt.step(wrapper.func, x, c=2.0)
      self.reset(opt)
  
      args2, kwargs2 = spy.call_args_list[-1]
  
      _, cost_three = opt.step_and_cost(wrapper.func, x, c=3.0)
      self.reset(opt)
  
      args3, kwargs3 = spy.call_args_list[-1]
  
      assert args2 == (x,)
      assert args3 == (x,)
  
      assert kwargs2 == {"c": 2.0}
      assert kwargs3 == {"c": 3.0}
  
      assert np.allclose(cost_three, wrapper.func(x, c=3.0), atol=tol)
  
file_path: pennylane/tests/optimize/test_optimize.py
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.optimize import GradientDescentOptimizer, MomentumOptimizer, NesterovMomentumOptimizer, AdagradOptimizer, RMSPropOptimizer, AdamOptimizer
label_desc: Use image node_id 1 for calling the TestOverOpts obj's underlying member method code with example usage: obj.test_kwargs(mocker, opt, opt_name, tol) and returns: unknown