class_docstr: Tests for the sample function
class_docstr_tok: ["Tests","for","the","sample","function"]
docstr: Test that samples for mid-circuit measurement values
  are correct for a single measurement value.
docstr_tok: ["Test","that","samples","for","mid-circuit","measurement","values","are","correct","for","a","single","measurement","value","."]
code: def test_observable_is_measurement_value(self, shots, phi):
      """Test that samples for mid-circuit measurement values
      are correct for a single measurement value."""
      dev = qml.device("default.qubit", wires=2, shots=shots)
  
      @qml.qnode(dev)
      def circuit(phi):
          qml.RX(phi, 0)
          m0 = qml.measure(0)
          return qml.sample(m0)
  
      res = circuit(phi)
  
      if isinstance(shots, list):
          assert len(res) == len(shots)
          assert all(r.shape == (s,) for r, s in zip(res, shots))
      else:
          assert res.shape == (shots,)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementShapeError, Sample, Shots
  from pennylane.operation import EigvalsUndefinedError, Operator
label_desc: Use image node_id 8 for calling the TestSample obj's underlying member method code with example usage: obj.test_observable_is_measurement_value(shots, phi) and returns: qml