code: def test_sanity(self, tmp_path):
      # internal version number
      assert re.search(
          r"\d+(\.\d+){1,3}$", features.version_codec("zlib")
      )
  
      test_file = str(tmp_path / "temp.png")
  
      hopper("RGB").save(test_file)
  
      with Image.open(test_file) as im:
          im.load()
          assert im.mode == "RGB"
          assert im.size == (128, 128)
          assert im.format == "PNG"
          assert im.get_format_mimetype() == "image/png"
  
      for mode in ["1", "L", "P", "RGB", "I", "I;16", "I;16B"]:
          im = hopper(mode)
          im.save(test_file)
          with Image.open(test_file) as reloaded:
              if mode in ("I;16", "I;16B"):
                  reloaded = reloaded.convert(mode)
              assert_image_equal(reloaded, im)
  
imports: from __future__ import annotations
  import re
  import sys
  import warnings
  import zlib
  from io import BytesIO
  import pytest
  from PIL import Image, ImageFile, PngImagePlugin, features
  from .helper import PillowLeakTestCase, assert_image, assert_image_equal, assert_image_equal_tofile, hopper, is_win32, mark_if_feature_version, skip_unless_feature
label_desc: Use image node_id 2 for calling the TestFilePng obj's underlying member method code with example usage: obj.test_sanity(tmp_path) without return types