class_docstr: Tests for the expval function
class_docstr_tok: ["Tests","for","the","expval","function"]
docstr: Test that expectation values for mid-circuit measurement values
  are correct for a composite measurement value.
docstr_tok: ["Test","that","expectation","values","for","mid-circuit","measurement","values","are","correct","for","a","composite","measurement","value","."]
code: def test_observable_is_composite_measurement_value(
      self, shots, phi, tol, tol_stochastic
  ):  # pylint: disable=too-many-arguments
      """Test that expectation values for mid-circuit measurement values
      are correct for a composite measurement value."""
      dev = qml.device("default.qubit")
  
      @qml.qnode(dev)
      def circuit(phi):
          qml.RX(phi, 0)
          m0 = qml.measure(0)
          qml.RX(0.5 * phi, 1)
          m1 = qml.measure(1)
          qml.RX(2 * phi, 2)
          m2 = qml.measure(2)
          return qml.expval(m0 * m1 + m2)
  
      res = circuit(phi, shots=shots)
  
      @qml.qnode(dev)
      def expected_circuit(phi):
          qml.RX(phi, 0)
          qml.RX(0.5 * phi, 1)
          qml.RX(2 * phi, 2)
          return (
              qml.expval(qml.Projector([1], 0)),
              qml.expval(qml.Projector([1], 1)),
              qml.expval(qml.Projector([1], 2)),
          )
  
      evals = expected_circuit(phi)
      expected = evals[0] * evals[1] + evals[2]
  
      atol = tol if shots is None else tol_stochastic
      assert np.allclose(np.array(res), expected, atol=atol, rtol=0)
  
imports: import copy
  import numpy
  import pytest
  import pennylane
  from pennylane.measurements import Expectation, Shots
  from pennylane.measurements.expval import ExpectationMP
label_desc: Use image node_id 5 for calling the TestExpval obj's underlying member method code with example usage: obj.test_observable_is_composite_measurement_value(shots, phi, tol, tol_stochastic) and returns: qml, qml,  qml,  qml