class_docstr: Test commute controlled on tape, qfunc and QNode.
class_docstr_tok: ["Test","commute","controlled","on","tape",",","qfunc","and","QNode","."]
docstr: Test the transform on a qfunc inside a qnode.
docstr_tok: ["Test","the","transform","on","a","qfunc","inside","a","qnode","."]
code: def test_qfunc(self):
      """Test the transform on a qfunc inside a qnode."""
  
      @qml.qnode(device=dev)
      def new_circuit():
          commute_controlled(qfunc_circuit)()
          return qml.expval(qml.PauliX(0) @ qml.PauliX(2))
  
      new_circuit()
      assert len(new_circuit.tape.operations) == 7
  
      names_expected = [
          "CNOT",
          "Toffoli",
          "PauliX",
          "RX",
          "CRX",
          "SX",
          "PauliX",
      ]
      wires_expected = [
          Wires([0, 2]),
          Wires([0, 1, 2]),
          Wires(2),
          Wires(2),
          Wires([0, 1]),
          Wires(1),
          Wires(1),
      ]
      compare_operation_lists(
          new_circuit.tape.operations, names_expected, wires_expected
      )
  
imports: import pytest
  from utils import compare_operation_lists, check_matrix_equivalence
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.transforms.optimization import commute_controlled
label_desc: Use image node_id 2 for calling the TestTransformDispatch obj's underlying member method code with example usage: obj.test_qfunc() and returns: qml