class_docstr: Tests for the SampleMeasurement class.
class_docstr_tok: ["Tests","for","the","SampleMeasurement","class","."]
docstr: Test the execution of a custom state measurement.
docstr_tok: ["Test","the","execution","of","a","custom","state","measurement","."]
code: def test_custom_state_measurement(self):
      """Test the execution of a custom state measurement."""
  
      class MyMeasurement(StateMeasurement):
          def process_state(self, state, wire_order):
              return qml.math.sum(state)
  
      dev = qml.device("default.qubit", wires=2)
  
      @qml.qnode(dev)
      def circuit():
          return MyMeasurement()
  
      assert circuit() == 1
  
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 1 for calling the TestStateMeasurement obj's underlying member method code with example usage: obj.test_custom_state_measurement() and returns: MyMeasurement, qml