class_docstr: Test that two-qubit unitary operations are correctly decomposed.
class_docstr_tok: ["Test","that","two-qubit","unitary","operations","are","correctly","decomposed","."]
docstr: Test that a two-qubit matrix using 2 CNOTs isolation is correctly decomposed.
docstr_tok: ["Test","that","a","two-qubit","matrix","using","2","CNOTs","isolation","is","correctly","decomposed","."]
code: def test_two_qubit_decomposition_2_cnots(self, U, wires):
      """Test that a two-qubit matrix using 2 CNOTs isolation is correctly decomposed."""
  
      U = _convert_to_su4(np.array(U))
  
      assert _compute_num_cnots(U) == 2
  
      obtained_decomposition = two_qubit_decomposition(U, wires=wires)
      assert len(obtained_decomposition) == 16
  
      with qml.queuing.AnnotatedQueue() as q:
          for op in obtained_decomposition:
              qml.apply(op)
  
      tape = qml.tape.QuantumScript.from_queue(q)
      obtained_matrix = qml.matrix(tape, wire_order=wires)
  
      assert check_matrix_equivalence(U, obtained_matrix, atol=1e-7)
  
imports: from functools import reduce
  import pytest
  from gate_data import I, Z, S, T, H, X, Y, CNOT, SWAP
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.ops.op_math.decompositions import one_qubit_decomposition
  from pennylane.ops.op_math.decompositions import two_qubit_decomposition
  from pennylane.ops.op_math.decompositions.two_qubit_unitary import _convert_to_su4, _su2su2_to_tensor_products, _compute_num_cnots
label_desc: Use image node_id 4 for calling the TestTwoQubitUnitaryDecomposition obj's underlying member method code with example usage: obj.test_two_qubit_decomposition_2_cnots(U, wires) without return types