code: def test_dipole_moment(
      symbols, geometry, core, charge, active, coeffs, ops
  ):
      r"""Test that dipole_moment returns the correct result."""
      mol = qchem.Molecule(symbols, geometry, charge=charge)
      args = [p for p in [geometry] if p.requires_grad]
      d = qchem.dipole_moment(
          mol, core=core, active=active, cutoff=1.0e-8
      )(*args)[0]
      d_ref = qml.Hamiltonian(coeffs, ops)
  
      assert np.allclose(sorted(d.coeffs), sorted(d_ref.coeffs))
      assert qml.Hamiltonian(np.ones(len(d.coeffs)), d.ops).compare(
          qml.Hamiltonian(np.ones(len(d_ref.coeffs)), d_ref.ops)
      )
  
      enable_new_opmath()
      d_op_math = qchem.dipole_moment(
          mol, core=core, active=active, cutoff=1.0e-8
      )(*args)[0]
      disable_new_opmath()
      d_ref_op_math = qml.dot(coeffs, ops)
  
      assert np.allclose(
          qml.matrix(d_op_math, wire_order=[0, 1, 2, 3]),
          qml.matrix(d_ref_op_math, wire_order=[0, 1, 2, 3]),
      )
  
file_path: pennylane/tests/qchem/test_dipole.py
imports: import pytest
  import pennylane
  from pennylane import PauliX, PauliY, PauliZ
  from pennylane import numpy
  from pennylane import qchem
  from pennylane.fermi import from_string
  from pennylane.operation import disable_new_opmath, enable_new_opmath
label_desc: Use image node_id 3 for calling a global function with example usage: test_dipole_moment(symbols, geometry, core, charge, active, coeffs, ops) without return types