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 a single-qubit gate changes correctly with a SWAP.
docstr_tok: ["Test","that","a","single-qubit","gate","changes","correctly","with","a","SWAP","."]
code: def test_one_qubit_gates_transform(self):
      """Test that a single-qubit gate changes correctly with a SWAP."""
  
      def qfunc():
          qml.Hadamard(wires=0)
          qml.PauliX(wires=1)
          qml.SWAP(wires=[0, 1])
          return qml.probs(1)
  
      transformed_qfunc = undo_swaps(qfunc)
  
      tape = qml.tape.make_qscript(transformed_qfunc)()
      res = qml.device("default.qubit", wires=2).execute(tape)
      assert len(tape.operations) == 2
      assert np.allclose(res[0], 0.5)
  
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 1 for calling the TestUndoSwaps obj's underlying member method code with example usage: obj.test_one_qubit_gates_transform() and returns: qml