class_docstr: Tests for the expval function
class_docstr_tok: ["Tests","for","the","expval","function"]
docstr: Test that a warning is raised if the provided
  argument might not be hermitian.
docstr_tok: ["Test","that","a","warning","is","raised","if","the","provided","argument","might","not","be","hermitian","."]
code: def test_not_an_observable(self, mocker):
      """Test that a warning is raised if the provided
      argument might not be hermitian."""
      dev = qml.device("default.qubit.legacy", wires=2)
  
      @qml.qnode(dev)
      def circuit():
          qml.RX(0.52, wires=0)
          return qml.expval(qml.prod(qml.PauliX(0), qml.PauliZ(0)))
  
      new_dev = circuit.device
      spy = mocker.spy(qml.QubitDevice, "expval")
  
      with pytest.warns(
          UserWarning, match="Prod might not be hermitian."
      ):
          _ = circuit()
  
      custom_measurement_process(new_dev, spy)
  
file_path: pennylane/tests/measurements/legacy/test_expval_legacy.py
imports: import numpy
  import pytest
  import pennylane
  from pennylane.measurements import Expectation, Shots
  from pennylane.devices.qubit.measure import flatten_state
label_desc: Use image node_id 2 for calling the TestExpval obj's underlying member method code with example usage: obj.test_not_an_observable(mocker) and returns: qml