code: def test_write_animation_RGB(tmp_path):
      """
      Write an animated WebP from RGB frames, and ensure the frames
      are visually similar to the originals.
      """
  
      def check(temp_file):
          with Image.open(temp_file) as im:
              assert im.n_frames == 2
  
              # Compare first frame to original
              im.load()
              assert_image_equal(im, frame1.convert("RGBA"))
  
              # Compare second frame to original
              if is_big_endian():
                  webp = parse_version(features.version_module("webp"))
                  if webp < parse_version("1.2.2"):
                      pytest.skip(
                          "Fails with libwebp earlier than 1.2.2"
                      )
              im.seek(1)
              im.load()
              assert_image_equal(im, frame2.convert("RGBA"))
  
      with Image.open("Tests/images/anim_frame1.webp") as frame1:
          with Image.open("Tests/images/anim_frame2.webp") as frame2:
              temp_file1 = str(tmp_path / "temp.webp")
              frame1.copy().save(
                  temp_file1,
                  save_all=True,
                  append_images=[frame2],
                  lossless=True,
              )
              check(temp_file1)
  
              # Tests appending using a generator
              def im_generator(ims):
                  yield from ims
  
              temp_file2 = str(tmp_path / "temp_generator.webp")
              frame1.copy().save(
                  temp_file2,
                  save_all=True,
                  append_images=im_generator([frame2]),
                  lossless=True,
              )
              check(temp_file2)
  
file_path: pillow/Tests/test_file_webp_animated.py
imports: from __future__ import annotations
  import pytest
  from packaging.version import parse
  from PIL import Image, features
  from .helper import assert_image_equal, assert_image_similar, is_big_endian, skip_unless_feature
label_desc: Use image node_id 3 for calling a global function with example usage: test_write_animation_RGB(tmp_path) without return types