docstr: Encoding G.722 properly converts sample rate to 16k
docstr_tok: ["Encoding","G.722","properly","converts","sample","rate","to","16k"]
code: def test_g722_sample_rate(self):
      """Encoding G.722 properly converts sample rate to 16k"""
      filename = "test.g722"
      sample_rate = 41000
      data = get_sinusoid(
          sample_rate=sample_rate, n_channels=1, channels_first=False
      )
  
      # write data
      dst = self.get_temp_path(filename)
      w = StreamWriter(dst, format="g722")
      w.add_audio_stream(sample_rate=sample_rate, num_channels=1)
      with w.open():
          w.write_audio_chunk(0, data)
  
      r = StreamReader(src=self.get_temp_path(filename))
      self.assertEqual(r.get_src_stream_info(0).sample_rate, 16000)
  
imports: import io
  import math
  import torch
  import torchaudio
  from parameterized import parameterized, parameterized_class
  from torchaudio.io import CodecConfig, StreamReader, StreamWriter
  from torchaudio_unittest.common_utils import get_asset_path, get_sinusoid, nested_params, rgb_to_yuv_ccir, skipIfNoFFmpeg, skipIfNoModule, TempDirMixin, TorchaudioTestCase
  from .common import lt42
label_desc: Use image node_id 7 for calling the StreamWriterCorrectnessTest obj's underlying member method code with example usage: obj.test_g722_sample_rate() without return types