class_docstr: Tests for the SampleMeasurement class.
class_docstr_tok: ["Tests","for","the","SampleMeasurement","class","."]
docstr: Test the execution of a custom sampled measurement.
docstr_tok: ["Test","the","execution","of","a","custom","sampled","measurement","."]
code: def test_custom_sample_measurement(self):
      """Test the execution of a custom sampled measurement."""
  
      class MyMeasurement(SampleMeasurement):
          # pylint: disable=signature-differs
          def process_samples(
              self, samples, wire_order, shot_range, bin_size
          ):
              return qml.math.sum(samples[..., self.wires])
  
      dev = qml.device("default.qubit.legacy", wires=2, shots=1000)
  
      @qml.qnode(dev)
      def circuit():
          qml.PauliX(0)
          return MyMeasurement(wires=[0]), MyMeasurement(wires=[1])
  
      assert qml.math.allequal(circuit(), [1000, 0])
  
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 TestSampleMeasurement obj's underlying member method code with example usage: obj.test_custom_sample_measurement() and returns: MyMeasurement,  MyMeasurement, qml