code: def test_apng_save_disposal(tmp_path):
      test_file = str(tmp_path / "temp.png")
      size = (128, 64)
      red = Image.new("RGBA", size, (255, 0, 0, 255))
      green = Image.new("RGBA", size, (0, 255, 0, 255))
      transparent = Image.new("RGBA", size, (0, 0, 0, 0))
  
      # test APNG_DISPOSE_OP_NONE
      red.save(
          test_file,
          save_all=True,
          append_images=[green, transparent],
          disposal=PngImagePlugin.APNG_DISPOSE_OP_NONE,
          blend=PngImagePlugin.APNG_BLEND_OP_OVER,
      )
      with Image.open(test_file) as im:
          im.seek(2)
          assert im.getpixel((0, 0)) == (0, 255, 0, 255)
          assert im.getpixel((64, 32)) == (0, 255, 0, 255)
  
      # test APNG_DISPOSE_OP_BACKGROUND
      disposal = [
          PngImagePlugin.APNG_DISPOSE_OP_NONE,
          PngImagePlugin.APNG_DISPOSE_OP_BACKGROUND,
          PngImagePlugin.APNG_DISPOSE_OP_NONE,
      ]
      red.save(
          test_file,
          save_all=True,
          append_images=[red, transparent],
          disposal=disposal,
          blend=PngImagePlugin.APNG_BLEND_OP_OVER,
      )
      with Image.open(test_file) as im:
          im.seek(2)
          assert im.getpixel((0, 0)) == (0, 0, 0, 0)
          assert im.getpixel((64, 32)) == (0, 0, 0, 0)
  
      disposal = [
          PngImagePlugin.APNG_DISPOSE_OP_NONE,
          PngImagePlugin.APNG_DISPOSE_OP_BACKGROUND,
      ]
      red.save(
          test_file,
          save_all=True,
          append_images=[green],
          disposal=disposal,
          blend=PngImagePlugin.APNG_BLEND_OP_OVER,
      )
      with Image.open(test_file) as im:
          im.seek(1)
          assert im.getpixel((0, 0)) == (0, 255, 0, 255)
          assert im.getpixel((64, 32)) == (0, 255, 0, 255)
  
      # test APNG_DISPOSE_OP_PREVIOUS
      disposal = [
          PngImagePlugin.APNG_DISPOSE_OP_NONE,
          PngImagePlugin.APNG_DISPOSE_OP_PREVIOUS,
          PngImagePlugin.APNG_DISPOSE_OP_NONE,
      ]
      red.save(
          test_file,
          save_all=True,
          append_images=[green, red, transparent],
          default_image=True,
          disposal=disposal,
          blend=PngImagePlugin.APNG_BLEND_OP_OVER,
      )
      with Image.open(test_file) as im:
          im.seek(3)
          assert im.getpixel((0, 0)) == (0, 255, 0, 255)
          assert im.getpixel((64, 32)) == (0, 255, 0, 255)
  
      disposal = [
          PngImagePlugin.APNG_DISPOSE_OP_NONE,
          PngImagePlugin.APNG_DISPOSE_OP_PREVIOUS,
      ]
      red.save(
          test_file,
          save_all=True,
          append_images=[green],
          disposal=disposal,
          blend=PngImagePlugin.APNG_BLEND_OP_OVER,
      )
      with Image.open(test_file) as im:
          im.seek(1)
          assert im.getpixel((0, 0)) == (0, 255, 0, 255)
          assert im.getpixel((64, 32)) == (0, 255, 0, 255)
  
      # test info disposal
      red.info["disposal"] = PngImagePlugin.APNG_DISPOSE_OP_BACKGROUND
      red.save(
          test_file,
          save_all=True,
          append_images=[Image.new("RGBA", (10, 10), (0, 255, 0, 255))],
      )
      with Image.open(test_file) as im:
          im.seek(1)
          assert im.getpixel((64, 32)) == (0, 0, 0, 0)
  
imports: import pytest
  from PIL import Image, ImageSequence, PngImagePlugin
label_desc: Use image node_id 18 for calling a global function with example usage: test_apng_save_disposal(tmp_path) without return types