docstr: self._save passes correct subtype to soundfile.write when WAV
docstr_tok: ["self._save","passes","correct","subtype","to","soundfile.write","when","WAV"]
code: def test_wav(
      self,
      dtype,
      sample_rate,
      num_channels,
      channels_first,
      enc_params,
      mocked_write,
  ):
      """self._save passes correct subtype to soundfile.write when WAV"""
      filepath = "foo.wav"
      input_tensor = get_wav_data(
          dtype,
          num_channels,
          num_frames=3 * sample_rate,
          normalize=dtype == "float32",
          channels_first=channels_first,
      ).t()
  
      encoding, bits_per_sample = enc_params
      self._save(
          filepath,
          input_tensor,
          sample_rate,
          channels_first=channels_first,
          encoding=encoding,
          bits_per_sample=bits_per_sample,
      )
  
      # on +Py3.8 call_args.kwargs is more descreptive
      args = mocked_write.call_args[1]
      assert args["file"] == filepath
      assert args["samplerate"] == sample_rate
      assert args["subtype"] == fetch_wav_subtype(
          dtype, encoding, bits_per_sample
      )
      assert args["format"] is None
      self.assertEqual(
          args["data"],
          input_tensor.t() if channels_first else input_tensor,
      )
  
imports: import io
  from functools import partial
  from unittest.mock import patch
  from torchaudio._backend.utils import get_save_func
  from torchaudio._internal import module_utils
  from torchaudio_unittest.common_utils import get_wav_data, load_wav, nested_params, PytorchTestCase, skipIfNoModule, TempDirMixin
  from .common import fetch_wav_subtype, parameterize, skipIfFormatNotSupported
label_desc: Use image node_id 1 for calling the MockedSaveTest obj's underlying member method code with example usage: obj.test_wav(dtype, sample_rate, num_channels, channels_first, enc_params, mocked_write) without return types