class_docstr: Test the new VQE syntax of passing the Hamiltonian as an observable.
class_docstr_tok: ["Test","the","new","VQE","syntax","of","passing","the","Hamiltonian","as","an","observable","."]
docstr: Tests simple VQE evaluations.
docstr_tok: ["Tests","simple","VQE","evaluations","."]
code: def test_circuits_evaluate(self, ansatz, observables, params, tol):
      """Tests simple VQE evaluations."""
      coeffs = [1.0] * len(observables)
      dev = qml.device("default.qubit", wires=3)
      H = qml.Hamiltonian(coeffs, observables)
  
      # pass H directly
      @qml.qnode(dev)
      def circuit():
          ansatz(params, wires=range(3))
          return qml.expval(H)
  
      res = circuit()
  
      res_expected = []
      for obs in observables:
  
          @qml.qnode(dev)
          def separate_circuit():
              ansatz(params, wires=range(3))
              return qml.expval(obs)
  
          res_expected.append(separate_circuit())
  
      res_expected = np.sum(
          [c * r for c, r in zip(coeffs, res_expected)]
      )
  
      assert np.isclose(res, res_expected, atol=tol)
  
imports: import copy
  import numpy
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestNewVQE obj's underlying member method code with example usage: obj.test_circuits_evaluate(ansatz, observables, params, tol) and returns: qml, qml