code: def test_subtitles(util):
      red = ColorClip((800, 600), color=(255, 0, 0)).with_duration(10)
      green = ColorClip((800, 600), color=(0, 255, 0)).with_duration(10)
      blue = ColorClip((800, 600), color=(0, 0, 255)).with_duration(10)
      myvideo = concatenate_videoclips([red, green, blue])
      assert myvideo.duration == 30
  
      generator = lambda txt: TextClip(
          txt,
          font=util.FONT,
          size=(800, 600),
          font_size=24,
          method="caption",
          align="South",
          color="white",
      )
  
      subtitles = SubtitlesClip("media/subtitles.srt", generator)
      final = CompositeVideoClip([myvideo, subtitles])
      final.subclip(0, 0.5).write_videofile(
          os.path.join(util.TMP_DIR, "subtitles.mp4"),
          fps=5,
          logger=None,
      )
  
      assert subtitles.subtitles == MEDIA_SUBTITLES_DATA
  
      subtitles = SubtitlesClip(MEDIA_SUBTITLES_DATA, generator)
      assert subtitles.subtitles == MEDIA_SUBTITLES_DATA
  
file_path: moviepy/tests/test_SubtitlesClip.py
imports: import os
  import pytest
  from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
  from moviepy.video.compositing.concatenate import concatenate_videoclips
  from moviepy.video.tools.subtitles import SubtitlesClip, file_to_subtitles
  from moviepy.video.VideoClip import ColorClip, TextClip
label_desc: Use image node_id 1 for calling a global function with example usage: test_subtitles(util) without return types