code: def test_qubit_observable(f_observable, q_observable):
      r"""Test that qubit_observable returns the correct operator."""
      h_as_hamiltonian = qchem.qubit_observable(f_observable)
      h_ref = qml.Hamiltonian(q_observable[0], q_observable[1])
  
      enable_new_opmath()
  
      h_as_op = qchem.qubit_observable(f_observable)
      h_ref_as_op = pauli_sentence(h_ref).operation(
          h_ref.wires
      )  # easy conversion from ham to operation
  
      disable_new_opmath()
  
      assert h_as_hamiltonian.compare(h_ref)
      assert np.allclose(
          qml.matrix(h_as_op, wire_order=[0, 1, 2]),
          qml.matrix(h_ref_as_op, wire_order=[0, 1, 2]),
      )
  
file_path: pennylane/tests/qchem/test_observable_hf.py
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane import qchem
  from pennylane.pauli import pauli_sentence
  from pennylane.operation import enable_new_opmath, disable_new_opmath
  from pennylane.fermi import from_string
label_desc: Use image node_id 2 for calling a global function with example usage: test_qubit_observable(f_observable, q_observable) without return types