class_docstr: Tests for the probs function
class_docstr_tok: ["Tests","for","the","probs","function"]
docstr: Test that an error is returned for hamiltonians.
docstr_tok: ["Test","that","an","error","is","returned","for","hamiltonians","."]
code: def test_hamiltonian_error(self, coeffs, obs, init_state):
      "Test that an error is returned for hamiltonians."
      H = qml.Hamiltonian(coeffs, obs)
  
      dev = qml.device("default.qubit.legacy", wires=4)
      state = init_state(4)
  
      @qml.qnode(dev)
      def circuit():
          qml.StatePrep(state, wires=list(range(4)))
          qml.PauliX(wires=0)
          qml.PauliZ(wires=1)
          qml.PauliY(wires=2)
          qml.PauliZ(wires=3)
          return qml.probs(op=H)
  
      with pytest.raises(
          qml.QuantumFunctionError,
          match="Hamiltonians are not supported for rotating probabilities.",
      ):
          circuit()
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.measurements import ProbabilityMP, Shots
  from pennylane.devices.qubit.measure import flatten_state
label_desc: Use image node_id 20 for calling the TestProbs obj's underlying member method code with example usage: obj.test_hamiltonian_error(coeffs, obs, init_state) and returns: qml