code: def test_trim(y_trim, top_db, ref, trim_duration):
      yt, idx = librosa.effects.trim(y_trim, top_db=top_db, ref=ref)
  
      # Test for index position
      fidx = [slice(None)] * y_trim.ndim
      fidx[-1] = slice(*idx.tolist())
      assert np.allclose(yt, y_trim[tuple(fidx)])
  
      # Verify logamp
      rms = librosa.feature.rms(y=librosa.to_mono(yt), center=False)
      logamp = librosa.power_to_db(rms**2, ref=ref, top_db=None)
      assert np.all(logamp > -top_db)
  
      # Verify logamp
      rms_all = librosa.feature.rms(y=librosa.to_mono(y_trim)).squeeze()
      logamp_all = librosa.power_to_db(
          rms_all**2, ref=ref, top_db=None
      )
  
      start = int(librosa.samples_to_frames(idx[0]))
      stop = int(librosa.samples_to_frames(idx[1]))
      assert np.all(logamp_all[:start] <= -top_db)
      assert np.all(logamp_all[stop:] <= -top_db)
  
      # Verify duration
      duration = librosa.get_duration(y=yt)
      assert np.allclose(duration, trim_duration, atol=1e-1), duration
  
imports: import warnings
  import os
  from contextlib import nullcontext
  import numpy
  import pytest
  import librosa
label_desc: Use image node_id 14 for calling a global function with example usage: test_trim(y_trim, top_db, ref, trim_duration) without return types