code: def test_vec_to_sym_matrix():
      # Check output value is correct
      vec = np.ones(6)
      sym = np.array(
          [
              [sqrt(2), 1.0, 1.0],
              [1.0, sqrt(2), 1.0],
              [1.0, 1.0, sqrt(2)],
          ]
      )
  
      assert_array_almost_equal(vec_to_sym_matrix(vec), sym)
  
      # Check output value is correct with separate diagonal
      vec = np.ones(3)
      diagonal = np.ones(3)
  
      assert_array_almost_equal(
          vec_to_sym_matrix(vec, diagonal=diagonal), sym
      )
      # Check vec_to_sym_matrix is the inverse function of sym_matrix_to_vec
      # when diagonal is included
      assert_array_almost_equal(
          vec_to_sym_matrix(sym_matrix_to_vec(sym)), sym
      )
  
      # when diagonal is discarded
      vec = sym_matrix_to_vec(sym, discard_diagonal=True)
      diagonal = np.diagonal(sym) / sqrt(2)
  
      assert_array_almost_equal(
          vec_to_sym_matrix(vec, diagonal=diagonal), sym
      )
  
imports: import copy
  import warnings
  from math import cosh, exp, log, sinh, sqrt
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from pandas import DataFrame
  from scipy import linalg
  from sklearn.covariance import EmpiricalCovariance, LedoitWolf
  from nilearn._utils.extmath import is_spd
  from nilearn.connectome.connectivity_matrices import ConnectivityMeasure, _check_spd, _check_square, _form_symmetric, _geometric_mean, _map_eigenvalues, prec_to_partial, sym_matrix_to_vec, vec_to_sym_matrix
  from nilearn.tests.test_signal import generate_signals
label_desc: Use image node_id 25 for calling a global function with example usage: test_vec_to_sym_matrix() without return types