code: def test_compressed_ext_case():
      # Test openers usually ignore case for compressed exts
      contents = b"palindrome of Bolton is notlob"
  
      class StrictOpener(Opener):
          compress_ext_icase = False
  
      exts = ("gz", "bz2", "GZ", "gZ", "BZ2", "Bz2")
      if HAVE_ZSTD:
          exts += ("zst", "ZST", "Zst")
      with InTemporaryDirectory():
          # Make a basic file to check type later
          with open(__file__, "rb") as a_file:
              file_class = type(a_file)
          for ext in exts:
              fname = "test." + ext
              with Opener(fname, "wb") as fobj:
                  fobj.write(contents)
              with Opener(fname, "rb") as fobj:
                  assert fobj.read() == contents
              os.unlink(fname)
              with StrictOpener(fname, "wb") as fobj:
                  fobj.write(contents)
              with StrictOpener(fname, "rb") as fobj:
                  assert fobj.read() == contents
              lext = ext.lower()
              if (
                  lext != ext
              ):  # extension should not be recognized -> file
                  assert isinstance(fobj.fobj, file_class)
              elif lext == "gz":
                  try:
                      from ..openers import IndexedGzipFile
                  except ImportError:
                      IndexedGzipFile = GzipFile
                  assert isinstance(
                      fobj.fobj, (GzipFile, IndexedGzipFile)
                  )
              elif lext == "zst":
                  assert isinstance(fobj.fobj, pyzstd.ZstdFile)
              else:
                  assert isinstance(fobj.fobj, BZ2File)
  
imports: import contextlib
  import hashlib
  import os
  import time
  import unittest
  from gzip import GzipFile
  from io import BytesIO, UnsupportedOperation
  from unittest import mock
  import pytest
  from packaging.version import Version
  from ..deprecator import ExpiredDeprecationError
  from ..openers import HAVE_INDEXED_GZIP, BZ2File, DeterministicGzipFile, ImageOpener, Opener
  from ..optpkg import optional_package
  from ..tmpdirs import InTemporaryDirectory
label_desc: Use image node_id 7 for calling a global function with example usage: test_compressed_ext_case() without return types