class_docstr: Tests for the SampleMeasurement class.
class_docstr_tok: ["Tests","for","the","SampleMeasurement","class","."]
docstr: Test that the device can override a measurement process.
docstr_tok: ["Test","that","the","device","can","override","a","measurement","process","."]
code: def test_method_overriden_by_device(self):
      """Test that the device can override a measurement process."""
  
      dev = qml.device("default.qubit.legacy", wires=2, shots=1000)
  
      @qml.qnode(dev)
      def circuit():
          qml.PauliX(0)
          return qml.sample(wires=[0]), qml.sample(wires=[1])
  
      circuit.device.measurement_map[SampleMP] = "test_method"
      circuit.device.test_method = (
          lambda obs, shot_range=None, bin_size=None: 2
      )
  
      assert qml.math.allequal(circuit(), [2, 2])
  
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 3 for calling the TestSampleMeasurement obj's underlying member method code with example usage: obj.test_method_overriden_by_device() and returns: qml,  qml