code: def test_covariances(estimator, rndstate):
      """Test covariance for multiple estimators"""
      n_matrices, n_channels, n_times = 2, 3, 100
      x = rndstate.randn(n_matrices, n_channels, n_times)
  
      if estimator is None:
          cov = covariances(x)
          assert cov.shape == (n_matrices, n_channels, n_channels)
      elif estimator == "truc":
          with pytest.raises(ValueError):
              covariances(x, estimator=estimator)
      else:
          cov = covariances(x, estimator=estimator)
          assert cov.shape == (n_matrices, n_channels, n_channels)
          assert is_sym_pos_def(cov)
  
          if estimator == "corr":
              assert_array_almost_equal(
                  np.diagonal(cov, axis1=-2, axis2=-1),
                  np.ones((n_matrices, n_channels)),
              )
          elif estimator == "tyl":
              assert_array_almost_equal(
                  np.trace(cov, axis1=-2, axis2=-1),
                  np.full(n_matrices, n_channels),
              )
  
imports: from numpy.testing import assert_array_almost_equal
  import numpy
  from scipy.linalg import block_diag
  from scipy.signal import welch, csd, coherence
  from sklearn.covariance import empirical_covariance
  import pytest
  from pyriemann.utils.covariance import covariances, covariances_EP, covariances_X, eegtocov, cross_spectrum, cospectrum, coherence, normalize, get_nondiag_weight, block_covariances, _complex_estimator
  from pyriemann.utils.test import is_real, is_hermitian, is_sym_pos_def, is_herm_pos_def
label_desc: Use image node_id 1 for calling a global function with example usage: test_covariances(estimator, rndstate) without return types