code: def test_cov2corr():
      cov_a = np.ones((3, 3)) + np.diag(np.arange(1, 4) ** 2 - 1)
      corr_a = np.array(
          [
              [1, 1 / 2.0, 1 / 3.0],
              [1 / 2.0, 1, 1 / 2.0 / 3.0],
              [1 / 3.0, 1 / 2.0 / 3.0, 1],
          ]
      )
  
      corr = cov2corr(cov_a)
      assert_almost_equal(corr, corr_a, decimal=15)
  
      cov_mat = cov_a
      corr_mat = cov2corr(cov_mat)
      assert_(isinstance(corr_mat, np.ndarray))
      assert_equal(corr_mat, corr)
  
      cov_ma = np.ma.array(cov_a)
      corr_ma = cov2corr(cov_ma)
      assert_equal(corr_mat, corr)
  
      assert_(isinstance(corr_ma, np.ma.core.MaskedArray))
  
      cov_ma2 = np.ma.array(
          cov_a,
          mask=[
              [False, True, False],
              [True, False, False],
              [False, False, False],
          ],
      )
  
      corr_ma2 = cov2corr(cov_ma2)
      assert_(np.ma.allclose(corr_ma, corr, atol=1e-15))
      assert_equal(corr_ma2.mask, cov_ma2.mask)
  
file_path: statsmodels/statsmodels/stats/tests/test_moment_helpers.py
imports: import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_, assert_equal
  from statsmodels.stats import moment_helpers
  from statsmodels.stats.moment_helpers import cov2corr, mvsk2mc, mc2mvsk, mnc2mc, mc2mnc, cum2mc, mc2cum, mnc2cum
label_desc: Use image node_id 1 for calling a global function with example usage: test_cov2corr() without return types