code: def test_bad_itxt(self):
      im = load(HEAD + chunk(b"iTXt") + TAIL)
      assert im.info == {}
  
      im = load(HEAD + chunk(b"iTXt", b"spam") + TAIL)
      assert im.info == {}
  
      im = load(HEAD + chunk(b"iTXt", b"spam\0") + TAIL)
      assert im.info == {}
  
      im = load(HEAD + chunk(b"iTXt", b"spam\0\x02") + TAIL)
      assert im.info == {}
  
      im = load(HEAD + chunk(b"iTXt", b"spam\0\0\0foo\0") + TAIL)
      assert im.info == {}
  
      im = load(
          HEAD + chunk(b"iTXt", b"spam\0\0\0en\0Spam\0egg") + TAIL
      )
      assert im.info == {"spam": "egg"}
      assert im.info["spam"].lang == "en"
      assert im.info["spam"].tkey == "Spam"
  
      im = load(
          HEAD
          + chunk(
              b"iTXt",
              b"spam\0\1\0en\0Spam\0" + zlib.compress(b"egg")[:1],
          )
          + TAIL
      )
      assert im.info == {"spam": ""}
  
      im = load(
          HEAD
          + chunk(
              b"iTXt", b"spam\0\1\1en\0Spam\0" + zlib.compress(b"egg")
          )
          + TAIL
      )
      assert im.info == {}
  
      im = load(
          HEAD
          + chunk(
              b"iTXt", b"spam\0\1\0en\0Spam\0" + zlib.compress(b"egg")
          )
          + TAIL
      )
      assert im.info == {"spam": "egg"}
      assert im.info["spam"].lang == "en"
      assert im.info["spam"].tkey == "Spam"
  
imports: import re
  import sys
  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 7 for calling the TestFilePng obj's underlying member method code with example usage: obj.test_bad_itxt() without return types