class_docstr: Test that check the main functionalities of the `undo_swaps` transform
class_docstr_tok: ["Test","that","check","the","main","functionalities","of","the","`","undo_swaps","`","transform"]
docstr: Test that transform works with several SWAPs.
docstr_tok: ["Test","that","transform","works","with","several","SWAPs","."]
code: def test_multi_swaps(self):
      """Test that transform works with several SWAPs."""
  
      def qfunc1():
          qml.Hadamard(wires=0)
          qml.PauliX(wires=1)
          qml.SWAP(wires=[0, 1])
          qml.SWAP(wires=[0, 2])
          qml.PauliY(wires=0)
          return qml.expval(qml.PauliZ(0))
  
      def qfunc2():
          qml.Hadamard(wires=1)
          qml.PauliX(wires=2)
          qml.PauliY(wires=0)
          return qml.expval(qml.PauliZ(0))
  
      transformed_qfunc = undo_swaps(qfunc1)
  
      tape1 = qml.tape.make_qscript(transformed_qfunc)()
      res1 = qml.device("default.qubit", wires=3).execute(tape1)
  
      tape2 = qml.tape.make_qscript(qfunc2)()
      res2 = qml.device("default.qubit", wires=3).execute(tape2)
  
      assert np.allclose(res1, res2)
  
file_path: pennylane/tests/transforms/test_optimization/test_undo_swaps.py
imports: import pytest
  from utils import compare_operation_lists
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.transforms.optimization import undo_swaps
label_desc: Use image node_id 5 for calling the TestUndoSwaps obj's underlying member method code with example usage: obj.test_multi_swaps() and returns: qml, qml