class_docstr: Unit tests for transpile function
class_docstr_tok: ["Unit","tests","for","transpile","function"]
docstr: test that transpile does not alter output for expectation value of an observable if the qfunc contains
  operations that act on any number of wires
docstr_tok: ["test","that","transpile","does","not","alter","output","for","expectation","value","of","an","observable","if","the","qfunc","contains","operations","that","act","on","any","number","of","wires"]
code: def test_transpile_ops_anywires(self):
      """test that transpile does not alter output for expectation value of an observable if the qfunc contains
      operations that act on any number of wires"""
      dev = qml.device("default.qubit", wires=[0, 1, 2])
  
      def circuit(param):
          qml.MultiRZ(param, wires=[0, 1])
          qml.PhaseShift(param, wires=2)
          qml.MultiRZ(param, wires=[0, 2])
          return qml.probs(wires=[0, 1])
  
      param = 0.3
  
      # build circuit without transpile
      original_qfunc = circuit
      original_qnode = qml.QNode(original_qfunc, dev)
      original_expectation = original_qnode(param)
  
      # build circuit with transpile
      transpiled_qfunc = transpile(
          original_qfunc, coupling_map=[(0, 1), (1, 2)]
      )
      transpiled_qnode = qml.QNode(transpiled_qfunc, dev)
      transpiled_expectation = transpiled_qnode(param)
  
      original_ops = list(transpiled_qnode.qtape)
      transpiled_ops = list(transpiled_qnode.qtape)
      assert qml.equal(transpiled_ops[0], original_ops[0])
      assert qml.equal(transpiled_ops[1], original_ops[1])
  
      # SWAP to ensure connectivity
      assert isinstance(transpiled_ops[2], qml.SWAP)
      assert transpiled_ops[2].wires == qml.wires.Wires([1, 2])
  
      assert isinstance(transpiled_ops[3], qml.MultiRZ)
      assert transpiled_ops[3].data == (param,)
      assert transpiled_ops[3].wires == qml.wires.Wires([0, 1])
  
      assert isinstance(
          transpiled_ops[4], qml.measurements.MeasurementProcess
      )
      assert transpiled_ops[4].wires == qml.wires.Wires([0, 2])
  
      assert qml.math.allclose(
          original_expectation,
          transpiled_expectation,
          atol=np.finfo(float).eps,
      )
  
imports: from math import isclose
  import pytest
  from pennylane import numpy
  import pennylane
  from pennylane.transforms.transpile import transpile
label_desc: Use image node_id 9 for calling the TestTranspile obj's underlying member method code with example usage: obj.test_transpile_ops_anywires() and returns: qml