docstr: Query compressed audio via file-like object works
docstr_tok: ["Query","compressed","audio","via","file-like","object","works"]
code: def _test_tarobj(self, ext, subtype, bits_per_sample):
      """Query compressed audio via file-like object works"""
      duration = 2
      sample_rate = 16000
      num_channels = 2
      num_frames = sample_rate * duration
      audio_file = f"test.{ext}"
      audio_path = self.get_temp_path(audio_file)
      archive_path = self.get_temp_path("archive.tar.gz")
  
      data = torch.randn(num_frames, num_channels).numpy()
      soundfile.write(audio_path, data, sample_rate, subtype=subtype)
  
      with tarfile.TarFile(archive_path, "w") as tarobj:
          tarobj.add(audio_path, arcname=audio_file)
      with tarfile.TarFile(archive_path, "r") as tarobj:
          fileobj = tarobj.extractfile(audio_file)
          info = self._info(fileobj)
      assert info.sample_rate == sample_rate
      assert info.num_frames == num_frames
      assert info.num_channels == num_channels
      assert info.bits_per_sample == bits_per_sample
      assert info.encoding == "FLAC" if ext == "flac" else "PCM_S"
  
imports: import tarfile
  import warnings
  from functools import partial
  from unittest.mock import patch
  import torch
  from torchaudio._backend.utils import get_info_func
  from torchaudio._internal import module_utils
  from torchaudio_unittest.backend.common import get_bits_per_sample, get_encoding
  from torchaudio_unittest.common_utils import get_wav_data, nested_params, PytorchTestCase, save_wav, skipIfNoModule, TempDirMixin
  from .common import parameterize, skipIfFormatNotSupported
label_desc: Use image node_id 4 for calling the TestFileObject obj's underlying member method code with example usage: obj._test_tarobj(ext, subtype, bits_per_sample) without return types