docstr: Can successfully set configuration and write audio.
docstr_tok: ["Can","successfully","set","configuration","and","write","audio","."]
code: def test_codec_config(self):
      """Can successfully set configuration and write audio."""
      ext = "mp3"
      filename = f"test.{ext}"
      sample_rate = 44100
      num_channels = 2
  
      # Write data
      dst = self.get_temp_path(filename)
      writer = torchaudio.io.StreamWriter(dst=dst, format=ext)
      codec_config = CodecConfig(bit_rate=198_000, compression_level=3)
      writer.add_audio_stream(
          sample_rate=sample_rate,
          num_channels=num_channels,
          codec_config=codec_config,
      )
  
      audio = torch.zeros((8000, 2))
      with writer.open():
          writer.write_audio_chunk(0, audio)
  
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 12 for calling the StreamWriterCorrectnessTest obj's underlying member method code with example usage: obj.test_codec_config() without return types