code: def test_ifd_rational_save(tmp_path):
      methods = (True, False)
      if not features.check("libtiff"):
          methods = (False,)
  
      for libtiff in methods:
          TiffImagePlugin.WRITE_LIBTIFF = libtiff
  
          im = hopper()
          out = str(tmp_path / "temp.tiff")
          res = IFDRational(301, 1)
          im.save(out, dpi=(res, res), compression="raw")
  
          with Image.open(out) as reloaded:
              assert float(IFDRational(301, 1)) == float(
                  reloaded.tag_v2[282]
              )
  
file_path: pillow-simd/Tests/test_tiff_ifdrational.py
imports: from fractions import Fraction
  from PIL import Image, TiffImagePlugin, features
  from PIL.TiffImagePlugin import IFDRational
  from .helper import hopper
label_desc: Use image node_id 5 for calling a global function with example usage: test_ifd_rational_save(tmp_path) without return types