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.legacy", wires=2)
  
      @qml.qnode(dev)
      def circuit():
          return MyMeasurement()
  
      assert circuit() == 1
  
file_path: pennylane/tests/measurements/legacy/test_measurements_legacy.py
imports: import pytest
  import pennylane
  from pennylane.measurements import ClassicalShadowMP, MeasurementProcess, MeasurementTransform, SampleMeasurement, SampleMP, Shots, StateMeasurement, StateMP, expval, var
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