class_docstr: Tests for the sample function
class_docstr_tok: ["Tests","for","the","sample","function"]
docstr: Test that the return type of the observable is :attr:`ObservableReturnTypes.Sample`
docstr_tok: ["Test","that","the","return","type","of","the","observable","is",":","attr",":","`","ObservableReturnTypes.Sample","`"]
code: def test_observable_return_type_is_sample(self, mocker):
      """Test that the return type of the observable is :attr:`ObservableReturnTypes.Sample`"""
      n_shots = 10
      dev = qml.device("default.qubit.legacy", wires=1, shots=n_shots)
      spy = mocker.spy(qml.QubitDevice, "sample")
  
      @qml.qnode(dev)
      def circuit():
          res = qml.sample(qml.PauliZ(0))
          assert res.return_type is Sample
          return res
  
      circuit()
  
      custom_measurement_process(dev, spy)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import MeasurementShapeError, Sample, Shots, MeasurementValue
  from pennylane.operation import Operator
label_desc: Use image node_id 10 for calling the TestSample obj's underlying member method code with example usage: obj.test_observable_return_type_is_sample(mocker) and returns: res