class_docstr: Tests for the SampleMeasurement class.
class_docstr_tok: ["Tests","for","the","SampleMeasurement","class","."]
docstr: Test that executing a state measurement with shots raises a warning.
code: def test_sample_measurement_with_shots(self, device):
      """Test that executing a state measurement with shots raises a warning."""
      dev = device(2)
      _skip_test_for_braket(dev)
  
      if dev.shots is None:
          pytest.skip("If shots=None no warning is raised.")
  
      class MyMeasurement(StateMeasurement):
          """Dummy state measurement."""
  
          def process_state(self, state, wire_order):
              return 1
  
      @qml.qnode(dev)
      def circuit():
          qml.PauliX(0)
          return MyMeasurement()
  
      with pytest.warns(
          UserWarning,
          match="Requested measurement MyMeasurement with finite shots",
      ):
          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 TestStateMeasurement obj's underlying member method code with example usage: obj.test_sample_measurement_with_shots(device) and returns: MyMeasurement, int