code: def test_sanity(tmp_path):
      for mode in _MODES:
  
          def roundtrip(original_im):
              out = str(tmp_path / "temp.tga")
  
              original_im.save(out, rle=rle)
              with Image.open(out) as saved_im:
                  if rle:
                      assert (
                          saved_im.info["compression"]
                          == original_im.info["compression"]
                      )
                  assert (
                      saved_im.info["orientation"]
                      == original_im.info["orientation"]
                  )
                  if mode == "P":
                      assert (
                          saved_im.getpalette()
                          == original_im.getpalette()
                      )
  
                  assert_image_equal(saved_im, original_im)
  
          png_paths = glob(
              os.path.join(_TGA_DIR_COMMON, f"*x*_{mode.lower()}.png")
          )
  
          for png_path in png_paths:
              with Image.open(png_path) as reference_im:
                  assert reference_im.mode == mode
  
                  path_no_ext = os.path.splitext(png_path)[0]
                  for origin, rle in product(_ORIGINS, (True, False)):
                      tga_path = "{}_{}_{}.tga".format(
                          path_no_ext, origin, "rle" if rle else "raw"
                      )
  
                      with Image.open(tga_path) as original_im:
                          assert original_im.format == "TGA"
                          assert (
                              original_im.get_format_mimetype()
                              == "image/x-tga"
                          )
                          if rle:
                              assert (
                                  original_im.info["compression"]
                                  == "tga_rle"
                              )
                          assert (
                              original_im.info["orientation"]
                              == _ORIGIN_TO_ORIENTATION[origin]
                          )
                          if mode == "P":
                              assert (
                                  original_im.getpalette()
                                  == reference_im.getpalette()
                              )
  
                          assert_image_equal(original_im, reference_im)
  
                          roundtrip(original_im)
  
file_path: pillow-simd/Tests/test_file_tga.py
imports: import os
  from glob import glob
  from itertools import product
  import pytest
  from PIL import Image
  from .helper import assert_image_equal, assert_image_equal_tofile, hopper
label_desc: Use image node_id 1 for calling a global function with example usage: test_sanity(tmp_path) without return types