code: def test_tifffile_reading_writing(test_images, tmp_path):
      """Test reading and saving tiff"""
  
      im2 = np.ones((10, 10, 3), np.uint8) * 2
  
      filename1 = tmp_path / "test_tiff.tiff"
  
      # One image
      iio.imsave(filename1, im2)
      im = iio.imread(filename1)
      ims = iio.mimread(filename1)
      assert im.shape == im2.shape
      assert (im == im2).all()
      assert len(ims) == 1
  
      # Multiple images
      iio.mimsave(filename1, [im2, im2, im2])
      im = iio.imread(filename1)
      ims = iio.mimread(filename1)
      assert im.shape == im2.shape
      assert (
          im == im2
      ).all()  # note: this does not imply that the shape match!
      assert len(ims) == 3
      for i in range(3):
          assert ims[i].shape == im2.shape
          assert (ims[i] == im2).all()
  
      # volumetric data
      iio.volwrite(filename1, np.tile(im2, (3, 1, 1, 1)))
      vol = iio.volread(filename1)
      vols = iio.mvolread(filename1)
      assert vol.shape == (3,) + im2.shape
      assert len(vols) == 1 and vol.shape == vols[0].shape
      for i in range(3):
          assert (vol[i] == im2).all()
  
      # remote channel-first volume rgb (2, 3, 10, 10)
      filename2 = test_images / "multipage_rgb.tif"
      img = iio.mimread(filename2)
      assert len(img) == 2
      assert img[0].shape == (3, 10, 10)
  
      # Mixed
      W = iio.save(filename1)
      W.set_meta_data({"planarconfig": "SEPARATE"})  # was "planar"
      assert W.format.name == "TIFF"
      W.append_data(im2)
      W.append_data(im2)
      W.close()
      #
      R = iio.read(filename1)
      assert R.format.name == "TIFF"
      ims = list(R)  # == [im for im in R]
      assert (ims[0] == im2).all()
      # meta = R.get_meta_data()
      # assert meta['orientation'] == 'top_left'  # not there in later version
      # Fail
      with pytest.raises(IndexError):
          R.get_data(-1)
  
      with pytest.raises(IndexError):
          R.get_data(3)
  
      # Ensure imread + imwrite works round trip
      filename3 = tmp_path / "test_tiff2.tiff"
      im1 = iio.imread(filename1)
      iio.imwrite(filename3, im1)
      im3 = iio.imread(filename3)
      assert im1.ndim == 3
      assert im1.shape == im3.shape
      assert (im1 == im3).all()
  
      # Ensure imread + imwrite works round trip - volume like
      filename3 = tmp_path / "test_tiff2.tiff"
      im1 = np.stack(iio.mimread(filename1))
      iio.volwrite(filename3, im1)
      im3 = iio.volread(filename3)
      assert im1.ndim == 4
      assert im1.shape == im3.shape
      assert (im1 == im3).all()
  
      # Read metadata
      md = iio.get_reader(filename2).get_meta_data()
      assert not md["is_imagej"]
      assert md["description"] == "shape=(2,3,10,10)"
      assert md["description1"] == ""
      assert md["datetime"] == datetime.datetime(2015, 5, 9, 9, 8, 29)
      assert md["software"] == "tifffile.py"
  
      # Write metadata
      dt = datetime.datetime(2018, 8, 6, 15, 35, 5)
      with iio.get_writer(filename1, software="testsoftware") as w:
          w.append_data(
              np.zeros((10, 10)),
              meta={"description": "test desc", "datetime": dt},
          )
          w.append_data(
              np.zeros((10, 10)), meta={"description": "another desc"}
          )
      with iio.get_reader(filename1) as r:
          for md in r.get_meta_data(), r.get_meta_data(0):
              assert "datetime" in md
              assert md["datetime"] == dt
              assert "software" in md
              assert md["software"] == "testsoftware"
              assert "description" in md
              assert md["description"] == "test desc"
  
          md = r.get_meta_data(1)
          assert "description" in md
          assert md["description"] == "another desc"
  
imports: import datetime
  import io
  import warnings
  from copy import deepcopy
  import numpy
  import pytest
  from conftest import deprecated_test
  import imageio.v2
  import imageio.v3
  from imageio.config import known_extensions, known_plugins
label_desc: Use image node_id 3 for calling a global function with example usage: test_tifffile_reading_writing(test_images, tmp_path) without return types