code: def test_main_pipeline(
      verbose=False,
      n=10,
      valid_noise_matrix=True,
      frac_zero_noise_rates=0,
  ):
      trace = 1.5
      py = [0.1, 0.1, 0.2, 0.6]
      K = len(py)
      y = [z for i, p in enumerate(py) for z in [i] * int(p * n)]
      nm = noise_generation.generate_noise_matrix_from_trace(
          K=K,
          trace=trace,
          py=py,
          seed=0,
          valid_noise_matrix=valid_noise_matrix,
          frac_zero_noise_rates=frac_zero_noise_rates,
      )
      # Check that trace is what its supposed to be
      assert abs(trace - np.trace(nm) < 1e-2)
      # Check that sum of probabilities is K
      assert abs(nm.sum() - K) < 1e-4
      # Check that sum of each column is 1
      assert all(abs(nm.sum(axis=0) - 1) < 1e-4)
      # Check that joint sums to 1.
      assert abs(np.sum(nm * py) - 1 < 1e-4)
      s = noise_generation.generate_noisy_labels(y, nm)
      assert noise_generation.noise_matrix_is_valid(nm, py)
  
imports: import numpy
  from cleanlab.benchmarking import noise_generation
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_main_pipeline(verbose, n, valid_noise_matrix, frac_zero_noise_rates) without return types