class_docstr: Tests for the gradient expand function
class_docstr_tok: ["Tests","for","the","gradient","expand","function"]
docstr: Test that a circuit with non-differentiable
  non-trainable operations is not expanded
docstr_tok: ["Test","that","a","circuit","with","non-differentiable","non-trainable","operations","is","not","expanded"]
code: def test_nontrainable_nondiff(self, mocker):
      """Test that a circuit with non-differentiable
      non-trainable operations is not expanded"""
      x = qml.numpy.array(0.2, requires_grad=False)
      y = qml.numpy.array(0.1, requires_grad=True)
  
      class NonDiffPhaseShift(qml.PhaseShift):
          grad_method = None
  
      with qml.queuing.AnnotatedQueue() as q:
          NonDiffPhaseShift(x, wires=0)
          qml.RY(y, wires=1)
          qml.CNOT(wires=[0, 1])
          qml.expval(qml.PauliZ(0))
  
      tape = qml.tape.QuantumScript.from_queue(q)
      params = tape.get_parameters(trainable_only=False)
      tape.trainable_params = qml.math.get_trainable_indices(params)
      assert tape.trainable_params == [1]
  
      spy = mocker.spy(tape, "expand")
      new_tape = qml.transforms.expand_invalid_trainable(tape)
  
      assert new_tape is tape
      spy.assert_not_called()
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 3 for calling the TestExpandInvalidTrainable obj's underlying member method code with example usage: obj.test_nontrainable_nondiff(mocker) without return types