code: def test_cross_similarity(n, k, metric):
      srand()
      # Make a data matrix
      data_ref = np.random.randn(3, n)
      data = np.random.randn(3, n + 7)
  
      D = librosa.segment.cross_similarity(
          data, data_ref, k=k, metric=metric
      )
  
      assert D.shape == (data_ref.shape[1], data.shape[1])
  
      if k is not None:
          real_k = min(k, n)
          assert not np.any(D.sum(axis=0) != real_k)
  
imports: from typing import Union
  import warnings
  import os
  import numpy
  import scipy
  from scipy.spatial.distance import cdist, pdist, squareform
  import pytest
  from test_core import srand
  import librosa
label_desc: Use image node_id 1 for calling a global function with example usage: test_cross_similarity(n, k, metric) without return types