code: def test_beat_units(ysr, hop_length, units, ctx):
      y, sr = ysr
      with ctx:
          _, b2 = librosa.beat.beat_track(
              y=y, sr=sr, hop_length=hop_length, units=units
          )
          tempo, b1 = librosa.beat.beat_track(
              y=y, sr=sr, hop_length=hop_length
          )
          t1 = librosa.frames_to_time(b1, sr=sr, hop_length=hop_length)
  
          if units == "time":
              t2 = b2
  
          elif units == "samples":
              t2 = librosa.samples_to_time(b2, sr=sr)
  
          elif units == "frames":
              t2 = librosa.frames_to_time(
                  b2, sr=sr, hop_length=hop_length
              )
  
          else:
              assert False
  
          assert np.allclose(t1, t2)
  
imports: import os
  import pytest
  from contextlib import nullcontext
  import numpy
  import scipy.stats
  import librosa
  from test_core import files, load
label_desc: Use image node_id 13 for calling a global function with example usage: test_beat_units(ysr, hop_length, units, ctx) without return types