code: def test_apng_syntax_errors():
      with pytest.warns(UserWarning):
          with Image.open(
              "Tests/images/apng/syntax_num_frames_zero.png"
          ) as im:
              assert not im.is_animated
              with pytest.raises(OSError):
                  im.load()
  
      with pytest.warns(UserWarning):
          with Image.open(
              "Tests/images/apng/syntax_num_frames_zero_default.png"
          ) as im:
              assert not im.is_animated
              im.load()
  
      # we can handle this case gracefully
      exception = None
      with Image.open(
          "Tests/images/apng/syntax_num_frames_low.png"
      ) as im:
          try:
              im.seek(im.n_frames - 1)
          except Exception as e:
              exception = e
          assert exception is None
  
      with pytest.raises(OSError):
          with Image.open(
              "Tests/images/apng/syntax_num_frames_high.png"
          ) as im:
              im.seek(im.n_frames - 1)
              im.load()
  
      with pytest.warns(UserWarning):
          with Image.open(
              "Tests/images/apng/syntax_num_frames_invalid.png"
          ) as im:
              assert not im.is_animated
              im.load()
  
imports: from __future__ import annotations
  import pytest
  from PIL import Image, ImageSequence, PngImagePlugin
label_desc: Use image node_id 14 for calling a global function with example usage: test_apng_syntax_errors() without return types