code: def test_dipole(
      symbols, coords, charge, hf_state, exp_dipole, tol, tmpdir
  ):
      r"""Tests the correctness of the computed dipole moment."""
  
      n_qubits = len(hf_state)
  
      dev = qml.device("default.qubit", wires=n_qubits)
  
      dip_obs = qml.qchem.dipole_of(
          symbols, coords, charge=charge, outpath=tmpdir.strpath
      )
  
      def circuit(params, wires):
          # pylint: disable=unused-argument
          qml.BasisState(hf_state, wires=wires)
  
      with pytest.warns(UserWarning, match="is deprecated,"):
          dipole = np.array(
              [
                  qml.ExpvalCost(circuit, obs, dev)(None)
                  for obs in dip_obs
              ]
          )
  
      assert np.allclose(dipole, exp_dipole, **tol)
  
imports: import numpy
  import pytest
  import pennylane
label_desc: Use image node_id 2 for calling a global function with example usage: test_dipole(symbols, coords, charge, hf_state, exp_dipole, tol, tmpdir) without return types