code: def test_recurrence_sparse(self):
      srand()
      data = np.random.randn(3, 100)
      D_sparse = librosa.segment.recurrence_matrix(
          data, sparse=True, self=self
      )
      D_dense = librosa.segment.recurrence_matrix(
          data, sparse=False, self=self
      )
  
      assert scipy.sparse.isspmatrix(D_sparse)
      assert np.allclose(D_sparse.todense(), D_dense)
  
      if self:
          assert np.allclose(D_sparse.diagonal(), True)
      else:
          assert np.allclose(D_sparse.diagonal(), False)
  
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 12 for calling a global function with example usage: test_recurrence_sparse() without return types