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 an error.
docstr_tok: ["Test","that","executing","a","state","measurement","with","shots","raises","an","error","."]
code: def test_state_measurement_with_shots(self):
      """Test that executing a state measurement with shots raises an error."""
  
      class MyMeasurement(StateMeasurement):
          def process_state(self, state, wire_order):
              return qml.math.sum(state)
  
          @property
          def return_type(self):
              return State
  
      dev = qml.device("default.qubit", wires=2, shots=1000)
  
      @qml.qnode(dev)
      def circuit():
          return MyMeasurement()
  
      with pytest.raises(
          qml.DeviceError,
          match="not accepted with finite shots on default.qubit",
      ):
          circuit()
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import ClassicalShadowMP, Counts, CountsMP, Expectation, ExpectationMP, MeasurementProcess, MeasurementTransform, MeasurementValue, MidMeasure, MidMeasureMP, MutualInfoMP, PurityMP, Probability, ProbabilityMP, Sample, SampleMeasurement, SampleMP, ShadowExpvalMP, Shots, State, StateMeasurement, StateMP, Variance, VarianceMP, VnEntropyMP, expval, sample, var
  from pennylane.operation import DecompositionUndefinedError
  from pennylane.queuing import AnnotatedQueue
  from pennylane.wires import Wires
label_desc: Use image node_id 2 for calling the TestStateMeasurement obj's underlying member method code with example usage: obj.test_state_measurement_with_shots() and returns: MyMeasurement, qml, State