class_docstr: Tests that the template defines the correct decomposition.
class_docstr_tok: ["Tests","that","the","template","defines","the","correct","decomposition","."]
docstr: Test arbitrarily generated permutations on QNodes.
docstr_tok: ["Test","arbitrarily","generated","permutations","on","QNodes","."]
code: def test_arbitrary_permutations_qnode(
      self, mocker, permutation_order, expected_wires
  ):
      """Test arbitrarily generated permutations on QNodes."""
  
      dev = qml.device("default.qubit", wires=len(permutation_order))
  
      @qml.qnode(dev, interface="autograd")
      def arbitrary_perm():
          qml.Permute(permutation_order, wires=dev.wires)
          return qml.expval(qml.PauliZ(0))
  
      spy = mocker.spy(arbitrary_perm.device, "execute")
      arbitrary_perm()
  
      tape = spy.call_args[0][0][0]
  
      # Check that the Permute operation was expanded to SWAPs when the QNode
      # is evaluated, and that the wires are the same
      assert all(op.name == "SWAP" for op in tape.operations)
      assert [
          op.wires.labels for op in tape.operations
      ] == expected_wires
  
imports: import pytest
  import numpy
  import pennylane
label_desc: Use image node_id 7 for calling the TestDecomposition obj's underlying member method code with example usage: obj.test_arbitrary_permutations_qnode(mocker, permutation_order, expected_wires) and returns: qml