class_docstr: Tests for the qml.simplify method used with qnodes.
class_docstr_tok: ["Tests","for","the","qml.simplify","method","used","with","qnodes","."]
docstr: Test the simplify method with a qnode.
docstr_tok: ["Test","the","simplify","method","with","a","qnode","."]
code: def test_simplify_qnode(self):
      """Test the simplify method with a qnode."""
      dev = qml.device("default.qubit", wires=2)
  
      @qml.qnode(dev)
      def qnode():
          qml.prod(
              qml.prod(qml.PauliX(0) ** 1, qml.PauliX(0)), qml.PauliZ(1)
          )
          return qml.expval(
              op=qml.prod(
                  qml.prod(qml.PauliX(0) ** 1, qml.PauliX(0)),
                  qml.PauliZ(1),
              )
          )
  
      simplified_tape_op = qml.PauliZ(1)
  
      s_qnode = qml.simplify(qnode)
      assert s_qnode() == qnode()
  
      [s_tape], _ = s_qnode.transform_program([s_qnode.tape])
      assert len(s_tape) == 2
  
      s_op = s_tape.operations[0]
      s_obs = s_tape.observables[0]
      assert isinstance(s_op, qml.PauliZ)
      assert s_op.data == simplified_tape_op.data
      assert s_op.wires == simplified_tape_op.wires
      assert (
          s_op.arithmetic_depth == simplified_tape_op.arithmetic_depth
      )
      assert isinstance(s_obs, qml.PauliZ)
      assert s_obs.data == simplified_tape_op.data
      assert s_obs.wires == simplified_tape_op.wires
      assert (
          s_obs.arithmetic_depth == simplified_tape_op.arithmetic_depth
      )
  
file_path: pennylane/tests/ops/functions/test_simplify.py
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.tape import QuantumScript
label_desc: Use image node_id 1 for calling the TestSimplifyQNodes obj's underlying member method code with example usage: obj.test_simplify_qnode() and returns: qml