docstr: `self._load` can load given format correctly.
  
  file encodings introduce delay and boundary effects so
  we create a reference wav file from the original file format
  
   x
   |
   |    1. Generate given format with Sox
   |
   + ----------------------------------+ 3. Convert to wav with FFmpeg
   |                                   |
   |    2. Load the given format       | 4. Load with scipy
   |       with torchaudio             |
   v                                   v
  tensor ----------> x <----------- tensor
                 5. Compare
  
  Underlying assumptions are;
  i. Conversion of given format to wav with FFmpeg preserves data.
  ii. Loading wav file with scipy is correct.
  
  By combining i & ii, step 2. and 4. allow for loading reference given format
  data without using torchaudio
docstr_tok: ["`","self._load","`","can","load","given","format","correctly",".","file","encodings","introduce","delay","and","boundary","effects","so","we","create","a","reference","wav","file","from","the","original","file","format","x","|","|","1",".","Generate","given","format","with","Sox","|","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","3",".","Convert","to","wav","with","FFmpeg","|","|","|","2",".","Load","the","given","format","|","4",".","Load","with","scipy","|","with","torchaudio","|","v","v","tensor","--","--","--","--","--",">","x","<","--","--","--","--","--","-","tensor","5",".","Compare","Underlying","assumptions","are",";","i",".","Conversion","of","given","format","to","wav","with","FFmpeg","preserves","data",".","ii",".","Loading","wav","file","with","scipy","is","correct",".","By","combining","i","&","ii",",","step","2.","and","4.","allow","for","loading","reference","given","format","data","without","using","torchaudio"]
code: def assert_format(
      self,
      format: str,
      sample_rate: float,
      num_channels: int,
      compression: float = None,
      bit_depth: int = None,
      duration: float = 1,
      normalize: bool = True,
      encoding: str = None,
      atol: float = 4e-05,
      rtol: float = 1.3e-06,
  ):
      """`self._load` can load given format correctly.
  
      file encodings introduce delay and boundary effects so
      we create a reference wav file from the original file format
  
       x
       |
       |    1. Generate given format with Sox
       |
       + ----------------------------------+ 3. Convert to wav with FFmpeg
       |                                   |
       |    2. Load the given format       | 4. Load with scipy
       |       with torchaudio             |
       v                                   v
      tensor ----------> x <----------- tensor
                     5. Compare
  
      Underlying assumptions are;
      i. Conversion of given format to wav with FFmpeg preserves data.
      ii. Loading wav file with scipy is correct.
  
      By combining i & ii, step 2. and 4. allow for loading reference given format
      data without using torchaudio
      """
      path = self.get_temp_path(f"1.original.{format}")
      ref_path = self.get_temp_path("2.reference.wav")
  
      # 1. Generate the given format with sox
      sox_utils.gen_audio_file(
          path,
          sample_rate,
          num_channels,
          encoding=encoding,
          compression=compression,
          bit_depth=bit_depth,
          duration=duration,
      )
      # 2. Load the given format with torchaudio
      data, sr = self._load(path, normalize=normalize)
  
      # 3. Convert to wav with ffmpeg
      if normalize:
          encoder = "pcm_f32le"
      else:
          encoding_map = {
              "floating-point": "PCM_F",
              "signed-integer": "PCM_S",
              "unsigned-integer": "PCM_U",
          }
          _, encoder, _ = _parse_save_args(
              format, format, encoding_map.get(encoding), bit_depth
          )
      _convert_audio_file(path, ref_path, encoder=encoder)
  
      # 4. Load wav with scipy
      data_ref = load_wav(ref_path, normalize=normalize)[0]
      # 5. Compare
      assert sr == sample_rate
      self.assertEqual(data, data_ref, atol=atol, rtol=rtol)
  
imports: import io
  import itertools
  import pathlib
  import tarfile
  from functools import partial
  from parameterized import parameterized
  from torchaudio._backend.ffmpeg import _parse_save_args
  from torchaudio._backend.utils import get_load_func
  from torchaudio._internal import module_utils
  from torchaudio_unittest.backend.dispatcher.sox.common import name_func
  from torchaudio_unittest.common_utils import disabledInCI, get_asset_path, get_wav_data, HttpServerMixin, load_wav, PytorchTestCase, save_wav, skipIfNoExec, skipIfNoFFmpeg, skipIfNoModule, sox_utils, TempDirMixin
  from .save_test import _convert_audio_file
label_desc: Use image node_id 1 for calling the LoadTestBase obj's underlying member method code with example usage: obj.assert_format(format, sample_rate, num_channels, compression, bit_depth, duration, normalize, encoding, atol, rtol) without return types