class_docstr: Test the helper function _grad_method_validation.
class_docstr_tok: ["Test","the","helper","function","_grad_method_validation","."]
docstr: Test that trainable parameters with numerical grad_method ``"F"``
  together with ``method="analytic"`` raises an exception.
docstr_tok: ["Test","that","trainable","parameters","with","numerical","grad_method","``","``","F","''","``","together","with","``","method=","''","analytic","''","``","raises","an","exception","."]
code: def test_with_numdiff_parameters_and_analytic(self):
      """Test that trainable parameters with numerical grad_method ``"F"``
      together with ``method="analytic"`` raises an exception."""
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(np.array(0.1, requires_grad=True), wires=0)
          qml.RX(np.array(0.1, requires_grad=True), wires=0)
          qml.expval(qml.PauliZ(0))
      tape = qml.tape.QuantumScript.from_queue(q)
      diff_methods = {
          0: "A",
          1: "F",
      }
      with pytest.raises(
          ValueError,
          match="The analytic gradient method cannot be used",
      ):
          _validate_gradient_methods(tape, "analytic", diff_methods)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.gradients.gradient_transform import _find_gradient_methods, _validate_gradient_methods, choose_trainable_params
label_desc: Use image node_id 2 for calling the TestGradMethodValidation obj's underlying member method code with example usage: obj.test_with_numdiff_parameters_and_analytic() without return types