class_docstr: Tests conditional operations
docstr: Test quantum teleportation.
docstr_tok: ["Test","quantum","teleportation","."]
code: def test_quantum_teleportation(self, rads):
      """Test quantum teleportation."""
  
      terminal_measurement = qml.probs(wires=2)
  
      with qml.queuing.AnnotatedQueue() as q:
          # Create Alice's secret qubit state
          qml.RY(rads, wires=0)
  
          # create an EPR pair with wires 1 and 2. 1 is held by Alice and 2 held by Bob
          qml.Hadamard(wires=1)
          qml.CNOT(wires=[1, 2])
  
          # Alice sends her qubits through a CNOT gate.
          qml.CNOT(wires=[0, 1])
  
          # Alice then sends the first qubit through a Hadamard gate.
          qml.Hadamard(wires=0)
  
          # Alice measures her qubits, obtaining one of four results, and sends this information to Bob.
          m_0 = qml.measure(0)
          m_1 = qml.measure(1, reset=True)
  
          # Given Alice's measurements, Bob performs one of four operations on his half of the EPR pair and
          # recovers the original quantum state.
          qml.cond(m_1, qml.RX)(math.pi, wires=2)
          qml.cond(m_0, qml.RZ)(math.pi, wires=2)
  
          qml.apply(terminal_measurement)
  
      tape = qml.tape.QuantumScript.from_queue(q)
  
      tapes, _ = qml.defer_measurements(tape)
      tape = tapes[0]
  
      assert (
          len(tape.operations) == 5 + 1 + 1 + 2
      )  # 5 regular ops + 1 measurement op + 1 reset op + 2 conditional ops
  
      assert len(tape.measurements) == 1
  
      # Check the each operation
      op1 = tape.operations[0]
      assert isinstance(op1, qml.RY)
      assert op1.wires == qml.wires.Wires(0)
      assert op1.data == (rads,)
  
      op2 = tape.operations[1]
      assert isinstance(op2, qml.Hadamard)
      assert op2.wires == qml.wires.Wires(1)
  
      op3 = tape.operations[2]
      assert isinstance(op3, qml.CNOT)
      assert op3.wires == qml.wires.Wires([1, 2])
  
      op4 = tape.operations[3]
      assert isinstance(op4, qml.CNOT)
      assert op4.wires == qml.wires.Wires([0, 1])
  
      op5 = tape.operations[4]
      assert isinstance(op5, qml.Hadamard)
      assert op5.wires == qml.wires.Wires([0])
  
      # Check the two underlying CNOTs for storing measurement state
      meas_op1 = tape.operations[5]
      assert isinstance(meas_op1, qml.CNOT)
      assert meas_op1.wires == qml.wires.Wires([1, 3])
  
      meas_op2 = tape.operations[6]
      assert isinstance(meas_op2, qml.CNOT)
      assert meas_op2.wires == qml.wires.Wires([3, 1])
  
      # Check the two underlying Controlled instances
      ctrl_op1 = tape.operations[7]
      assert isinstance(ctrl_op1, qml.ops.op_math.Controlled)
      assert qml.equal(ctrl_op1.base, qml.RX(math.pi, 2))
      assert ctrl_op1.wires == qml.wires.Wires([3, 2])
  
      ctrl_op2 = tape.operations[8]
      assert isinstance(ctrl_op2, qml.ops.op_math.Controlled)
      assert qml.equal(ctrl_op2.base, qml.RZ(math.pi, 2))
      assert ctrl_op2.wires == qml.wires.Wires([0, 2])
  
      # Check the measurement
      assert qml.equal(tape.measurements[0], terminal_measurement)
  
imports: import math
  import pytest
  import pennylane
  from pennylane.measurements import MidMeasureMP, MeasurementValue
  import pennylane.numpy
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 4 for calling the TestConditionalOperations obj's underlying member method code with example usage: obj.test_quantum_teleportation(rads) without return types