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.
code: def test_method_overriden_by_device(self, device):
      """Test that the device can override a measurement process."""
      dev = device(2)
  
      _skip_test_for_braket(dev)
  
      @qml.qnode(dev, interface="autograd")
      def circuit():
          qml.PauliX(0)
          return qml.state()
  
      circuit.device.measurement_map[StateMP] = "test_method"
      circuit.device.test_method = (
          lambda obs, shot_range=None, bin_size=None: 2
      )
  
      assert circuit() == 2
  
imports: import pytest
  from flaky import flaky
  from scipy.sparse import csr_matrix
  import pennylane
  from pennylane import numpy
  from pennylane.measurements import ClassicalShadowMP, MeasurementTransform, SampleMeasurement, SampleMP, StateMeasurement, StateMP
label_desc: Use image node_id 3 for calling the TestStateMeasurement obj's underlying member method code with example usage: obj.test_method_overriden_by_device(device) and returns: qml