code: def test_reading_saving(test_images, tmp_path):
      fname1 = test_images / "stent.swf"
      fname2 = tmp_path / "stent.out.swf"
      fname3 = tmp_path / "stent.compressed.swf"
      fname4 = tmp_path / "stent.out2.swf"
  
      # Read
      R = iio.read(fname1)
      assert len(R) == 10
      assert R.get_meta_data() == {}  # always empty dict
      ims1 = []
      for im in R:
          assert im.shape == (657, 451, 4)
          assert mean(im) > 0
          ims1.append(im)
      # Seek
      assert (R.get_data(3) == ims1[3]).all()
      # Fails
      with pytest.raises(IndexError):
          R.get_data(-1)  # No negative index
  
      with pytest.raises(IndexError):
          R.get_data(10)  # Out of bounds
      R.close()
  
      # Test loop
      R = iio.read(fname1, loop=True)
      assert (R.get_data(10) == ims1[0]).all()
  
      # setting meta data is ignored
      W = iio.save(fname2)
      W.set_meta_data({"foo": 3})
      W.close()
  
      # Just make sure mimread works
      assert len(iio.mimread(fname1)) == 10
  
      # I'm not sure why, but the below does not work on pypy, which is weird,
      # because the file *is* closed, but somehow it's not flushed? Ah well ...
      if IS_PYPY:
          return
  
      # Write and re-read, now without loop, and with html page
      iio.mimsave(fname2, ims1, loop=False, html=True)
      ims2 = iio.mimread(fname2)
  
      # Check images. We can expect exact match, since
      # SWF is lossless.
      assert len(ims1) == len(ims2)
      for im1, im2 in zip(ims1, ims2):
          assert (im1 == im2).all()
  
      # Test compressed
      iio.mimsave(fname3, ims2, compress=True)
      ims3 = iio.mimread(fname3)
      assert len(ims1) == len(ims3)
      for im1, im3 in zip(ims1, ims3):
          assert (im1 == im3).all()
  
      # Test conventional, Bonus, we don't officially support this.
      _swf = imageio.plugins.swf.load_lib()
      _swf.write_swf(fname4, ims1)
      ims4 = _swf.read_swf(fname4)
      assert len(ims1) == len(ims4)
      for im1, im4 in zip(ims1, ims4):
          assert (im1 == im4).all()
  
      # We want to manually validate that this file plays in 3d party tools
      # So we write a small HTML5 doc that we can load
      html = """<!DOCTYPE html>
              <html>
              <body>
              Original:
              <embed src="%s">
              <br ><br >
              Written:
              <embed src="%s">
              <br ><br >
              Compressed:
              <embed src="%s">
              <br ><br >
              Written 2:
              <embed src="%s">
              </body>
              </html>
              """ % (
          fname1,
          fname2,
          fname3,
          fname4,
      )
  
      with open(tmp_path / "test_swf.html", "wb") as f:
          for line in html.splitlines():
              f.write(line.strip().encode("utf-8") + b"\n")
  
file_path: imageio/tests/test_swf.py
imports: import numpy
  import pytest
  import imageio.v2
  import imageio.plugins
  from imageio import core
  from imageio.core import IS_PYPY
  from conftest import deprecated_test
label_desc: Use image node_id 3 for calling a global function with example usage: test_reading_saving(test_images, tmp_path) without return types