code: def test_sample_statistics(kernel):
      # Test that statistics of samples drawn from GP are correct.
      gpr = GaussianProcessRegressor(kernel=kernel).fit(X, y)
  
      y_mean, y_cov = gpr.predict(X2, return_cov=True)
  
      samples = gpr.sample_y(X2, 300000)
  
      # More digits accuracy would require many more samples
      assert_almost_equal(y_mean, np.mean(samples, 1), 1)
      assert_almost_equal(
          np.diag(y_cov) / np.diag(y_cov).max(),
          np.var(samples, 1) / np.diag(y_cov).max(),
          1,
      )
  
imports: import re
  import sys
  import warnings
  import numpy
  import pytest
  from scipy.optimize import approx_fprime
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.gaussian_process import GaussianProcessRegressor
  from sklearn.gaussian_process.kernels import RBF, DotProduct, ExpSineSquared, WhiteKernel
  from sklearn.gaussian_process.kernels import ConstantKernel
  from sklearn.gaussian_process.tests._mini_sequence_kernel import MiniSeqKernel
  from sklearn.utils._testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_less
label_desc: Use image node_id 11 for calling a global function with example usage: test_sample_statistics(kernel) without return types