class_docstr: Tests that the template defines the correct decomposition.
class_docstr_tok: ["Tests","that","the","template","defines","the","correct","decomposition","."]
docstr: Test the correctness of the FermionicSingleExcitation template including the gate count
  and order, the wires each operation acts on and the correct use of parameters
  in the circuit.
docstr_tok: ["Test","the","correctness","of","the","FermionicSingleExcitation","template","including","the","gate","count","and","order",",","the","wires","each","operation","acts","on","and","the","correct","use","of","parameters","in","the","circuit","."]
code: def test_single_ex_unitary_operations(self, single_wires, ref_gates):
      """Test the correctness of the FermionicSingleExcitation template including the gate count
      and order, the wires each operation acts on and the correct use of parameters
      in the circuit."""
      # pylint: disable=protected-access
  
      sqg = 10
      cnots = 4 * (len(single_wires) - 1)
      weight = np.pi / 3
      op = qml.FermionicSingleExcitation(weight, wires=single_wires)
      queue = op.expand().operations
  
      assert len(queue) == sqg + cnots
  
      for gate in ref_gates:
          idx = gate[0]
  
          exp_gate = gate[1]
          res_gate = queue[idx]
          assert isinstance(res_gate, exp_gate)
  
          exp_wires = gate[2]
          res_wires = queue[idx]._wires
          assert res_wires.tolist() == exp_wires
  
          exp_weight = gate[3]
          res_weight = queue[idx].parameters
          assert res_weight == exp_weight
  
file_path: pennylane/tests/templates/test_subroutines/test_single_excitation.py
imports: import pytest
  import numpy
  from pennylane import numpy
  import pennylane
label_desc: Use image node_id 1 for calling the TestDecomposition obj's underlying member method code with example usage: obj.test_single_ex_unitary_operations(single_wires, ref_gates) without return types