class_docstr: Test for measurement expansion
class_docstr_tok: ["Test","for","measurement","expansion"]
docstr: Test that measurements of Hermitians report to have a decomposition.
docstr_tok: ["Test","that","measurements","of","Hermitians","report","to","have","a","decomposition","."]
code: def test_has_decomposition_false_hermitian_wo_diaggates(self):
      """Test that measurements of Hermitians report to have a decomposition."""
  
      class HermitianNoDiagGates(qml.Hermitian):
          @property
          def has_diagonalizing_gates(
              self,
          ):  # pylint: disable=invalid-overridden-method, arguments-renamed
              return False
  
      H = np.array([[1, 2], [2, 4]])
      obs = HermitianNoDiagGates(H, wires=["a"])
      m = ExpectationMP(obs=obs)
      assert m.has_decomposition is False
  
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 6 for calling the TestExpansion obj's underlying member method code with example usage: obj.test_has_decomposition_false_hermitian_wo_diaggates() and returns: False