code: def test_gridliner_constrained_adjust_datalim():
      fig = plt.figure(figsize=(8, 4), layout="constrained")
  
      # Make some axes that will fill the available space while maintaining
      # correct aspect ratio
      ax = fig.add_subplot(projection=ccrs.PlateCarree())
      ax.set_aspect(aspect="equal", adjustable="datalim")
  
      # Add some polygon to the map, with a colour bar
      collection = PolyCollection(
          verts=[
              [[0, 0], [1, 0], [1, 1], [0, 1]],
              [[1, 0], [2, 0], [2, 1], [1, 1]],
              [[0, 1], [1, 1], [1, 2], [0, 2]],
              [[1, 1], [2, 1], [2, 2], [1, 2]],
          ],
          array=[1, 2, 3, 4],
      )
      ax.add_collection(collection)
      fig.colorbar(collection, ax=ax, location="right")
  
      # Set up the axes data limits to keep the polygon in view
      ax.autoscale()
  
      # Add some gridlines
      ax.gridlines(
          draw_labels=["bottom", "left"],
          auto_update=True,
          linestyle="-",
      )
  
      return fig
  
imports: import io
  from unittest import mock
  from matplotlib.collections import PolyCollection
  import matplotlib.pyplot
  import matplotlib.ticker
  import numpy
  import pytest
  from shapely.geos import geos_version
  import cartopy.crs
  from cartopy.mpl import _MPL_36
  from cartopy.mpl.geoaxes import GeoAxes
  from cartopy.mpl.gridliner import LATITUDE_FORMATTER, LONGITUDE_FORMATTER, Gridliner, classic_formatter, classic_locator
  from cartopy.mpl.ticker import LongitudeFormatter, LongitudeLocator
label_desc: Use image node_id 5 for calling a global function with example usage: test_gridliner_constrained_adjust_datalim() and returns: fig