class_docstr: Tests for the SampleMeasurement class.
class_docstr_tok: ["Tests","for","the","SampleMeasurement","class","."]
docstr: Test that executing a sampled measurement with ``shots=None`` raises an error.
code: def test_sample_measurement_without_shots(self, device):
      """Test that executing a sampled measurement with ``shots=None`` raises an error."""
      dev = device(2)
  
      if dev.shots is not None:
          pytest.skip("If shots!=None no error is raised.")
  
      class MyMeasurement(SampleMeasurement):
          """Dummy sampled measurement."""
  
          def process_samples(
              self, samples, wire_order, shot_range=None, bin_size=None
          ):
              return 1
  
      @qml.qnode(dev)
      def circuit():
          qml.PauliX(0)
          return MyMeasurement(wires=[0]), MyMeasurement(wires=[1])
  
      with pytest.raises(
          ValueError,
          match="Shots must be specified in the device to compute the measurement ",
      ):
          circuit()
  
imports: import pytest
  from flaky import flaky
  from scipy.sparse import csr_matrix
  import pennylane
  from pennylane import numpy
  from pennylane.measurements import ClassicalShadowMP, MeasurementTransform, SampleMeasurement, SampleMP, StateMeasurement, StateMP
label_desc: Use image node_id 2 for calling the TestSampleMeasurement obj's underlying member method code with example usage: obj.test_sample_measurement_without_shots(device) and returns: MyMeasurement,  MyMeasurement, int