code: def test_resampy(self):
      old_sr = 3
      new_sr = 2
      x = pure_tone(7, sr=128, dur=3) + pure_tone(24, sr=128, dur=3)
      y_re = th.from_numpy(
          resampy.resample(x.numpy(), old_sr, new_sr)
      ).float()
      y = resample.resample_frac(x, old_sr, new_sr)
      self.assertSimilar(y, y_re, x, f"{old_sr} to {new_sr}")
  
      old_sr = 2
      new_sr = 5
      x = pure_tone(7, sr=128) + pure_tone(48, sr=128)
      y_re = th.from_numpy(
          resampy.resample(x.numpy(), old_sr, new_sr)
      ).float()
      y = resample.resample_frac(x, old_sr, new_sr)
      self.assertSimilar(y, y_re, x, f"{old_sr} to {new_sr}")
  
      random.seed(1234)
      th.manual_seed(1234)
      for _ in range(10):
          old_sr = random.randrange(8, 128)
          new_sr = random.randrange(8, 128)
          x = th.randn(1024)
          y_re = th.from_numpy(
              resampy.resample(x.numpy(), old_sr, new_sr)
          ).float()
          y = resample.resample_frac(x, old_sr, new_sr, zeros=56)
          # We allow some relatively high tolerance as we are not using the same window.
          self.assertSimilar(y, y_re, x, f"{old_sr} to {new_sr}", tol=2)
  
imports: import os
  import tempfile
  import uuid
  from pathlib import Path
  import math
  import random
  import unittest
  import resampy
  import torch
  from julius import resample, ResampleFrac
label_desc: Use image node_id 2 for calling the TestResampleFrac obj's underlying member method code with example usage: obj.test_resampy() without return types