class_docstr: Tests that verify that the cond transform works as expect.
class_docstr_tok: ["Tests","that","verify","that","the","cond","transform","works","as","expect","."]
docstr: Test that qml.cond creates conditional operations as expected.
docstr_tok: ["Test","that","qml.cond","creates","conditional","operations","as","expected","."]
code: def test_cond_ops(self, terminal_measurement):
      """Test that qml.cond creates conditional operations as expected."""
      r = 1.234
  
      def f(x):
          qml.PauliX(1)
          qml.RY(x, wires=1)
          qml.PauliZ(1)
  
      with qml.queuing.AnnotatedQueue() as q:
          m_0 = qml.measure(0)
          qml.cond(m_0, f)(r)
          qml.apply(terminal_measurement)
  
      tape = qml.tape.QuantumScript.from_queue(q)
      ops = tape.operations
      target_wire = qml.wires.Wires(1)
  
      assert len(ops) == 4
      assert ops[0].return_type == qml.measurements.MidMeasure
  
      assert isinstance(ops[1], qml.ops.Conditional)
      assert isinstance(ops[1].then_op, qml.PauliX)
      assert ops[1].then_op.wires == target_wire
  
      assert isinstance(ops[2], qml.ops.Conditional)
      assert isinstance(ops[2].then_op, qml.RY)
      assert ops[2].then_op.wires == target_wire
      assert ops[2].then_op.data == (r,)
  
      assert isinstance(ops[3], qml.ops.Conditional)
      assert isinstance(ops[3].then_op, qml.PauliZ)
      assert ops[3].then_op.wires == target_wire
  
      assert len(tape.measurements) == 1
      assert tape.measurements[0] is terminal_measurement
  
file_path: pennylane/tests/ops/op_math/test_condition.py
imports: import pytest
  import pennylane
  from pennylane.ops.op_math.condition import ConditionalTransformError
label_desc: Use image node_id 1 for calling the TestCond obj's underlying member method code with example usage: obj.test_cond_ops(terminal_measurement) without return types