code: def test_composite_image():
      # Test that figures can be saved with and without combining multiple images
      # (on a single set of axes) into a single composite image.
      X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
      Z = np.sin(Y**2)
      fig, ax = plt.subplots()
      ax.set_xlim(0, 3)
      ax.imshow(Z, extent=[0, 1, 0, 1])
      ax.imshow(Z[::-1], extent=[2, 3, 0, 1])
      plt.rcParams["image.composite_image"] = True
      with PdfPages(io.BytesIO()) as pdf:
          fig.savefig(pdf, format="pdf")
          assert len(pdf._file._images) == 1
      plt.rcParams["image.composite_image"] = False
      with PdfPages(io.BytesIO()) as pdf:
          fig.savefig(pdf, format="pdf")
          assert len(pdf._file._images) == 2
  
imports: import datetime
  import decimal
  import io
  import os
  from pathlib import Path
  import numpy
  import pytest
  import matplotlib
  from matplotlib import pyplot, rcParams, font_manager
  from matplotlib.cbook import _get_data_path
  from matplotlib.ft2font import FT2Font
  from matplotlib.font_manager import findfont, FontProperties
  from matplotlib.backends._backend_pdf_ps import get_glyphs_subset
  from matplotlib.backends.backend_pdf import PdfPages
  from matplotlib.patches import Rectangle
  from matplotlib.testing.decorators import check_figures_equal, image_comparison
  from matplotlib.testing._markers import needs_usetex
label_desc: Use image node_id 6 for calling a global function with example usage: test_composite_image() without return types