code: def test_subsegment(mfcc, beats, n_segments):
      subseg = librosa.segment.subsegment(
          mfcc, beats, n_segments=n_segments, axis=-1
      )
  
      # Make sure that the boundaries are within range
      assert subseg.min() >= 0
      assert subseg.max() <= mfcc.shape[-1]
  
      # Make sure that all input beats are retained
      for b in beats:
          assert b in subseg
  
      # Do we have a 0 marker?
      assert 0 in subseg
  
      # Did we over-segment?  +2 here for 0- and end-padding
      assert len(subseg) <= n_segments * (len(beats) + 2)
  
      # Verify that running on the transpose gives the same answer
      ss2 = librosa.segment.subsegment(
          mfcc.T, beats, n_segments=n_segments, axis=0
      )
      assert np.allclose(subseg, ss2)
  
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 37 for calling a global function with example usage: test_subsegment(mfcc, beats, n_segments) without return types