class_docstr: Test that adjacent inverse gates are cancelled.
class_docstr_tok: ["Test","that","adjacent","inverse","gates","are","cancelled","."]
docstr: Test that Toffolis on different permutations of wires cancel correctly.
docstr_tok: ["Test","that","Toffolis","on","different","permutations","of","wires","cancel","correctly","."]
code: def test_three_qubits_toffolis(self):
      """Test that Toffolis on different permutations of wires cancel correctly."""
  
      def qfunc():
          # These two will cancel
          qml.Toffoli(wires=["a", "b", "c"])
          qml.Toffoli(wires=["b", "a", "c"])
          # These three will not cancel
          qml.Toffoli(wires=["a", "b", "c"])
          qml.Toffoli(wires=["a", "c", "b"])
          qml.Toffoli(wires=["a", "c", "d"])
  
      transformed_qfunc = cancel_inverses(qfunc)
  
      ops = qml.tape.make_qscript(transformed_qfunc)().operations
  
      names_expected = ["Toffoli"] * 3
      wires_expected = [
          Wires(["a", "b", "c"]),
          Wires(["a", "c", "b"]),
          Wires(["a", "c", "d"]),
      ]
      compare_operation_lists(ops, names_expected, wires_expected)
  
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 cancel_inverses
label_desc: Use image node_id 8 for calling the TestCancelInverses obj's underlying member method code with example usage: obj.test_three_qubits_toffolis() without return types