class_docstr: Test the helper function _grad_method_validation.
class_docstr_tok: ["Test","the","helper","function","_grad_method_validation","."]
docstr: Test that trainable parameters without grad_method
  are detected correctly, raising an exception.
docstr_tok: ["Test","that","trainable","parameters","without","grad_method","are","detected","correctly",",","raising","an","exception","."]
code: def test_with_nondiff_parameters(self, method):
      """Test that trainable parameters without grad_method
      are detected correctly, raising 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: None}
      with pytest.raises(
          ValueError, match="Cannot differentiate with respect"
      ):
          _validate_gradient_methods(tape, method, 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 1 for calling the TestGradMethodValidation obj's underlying member method code with example usage: obj.test_with_nondiff_parameters(method) without return types