code: def test_coastline_loading_cache():
      # a5caae040ee11e72a62a53100fe5edc355304419 added coastline caching.
      # This test ensures it is working.
      fig = plt.figure()
  
      # Create coastlines to ensure they are cached.
      ax1 = fig.add_subplot(2, 1, 1, projection=ccrs.PlateCarree())
      ax1.coastlines()
      fig.canvas.draw()
      # Create another instance of the coastlines and count
      # the number of times shapereader.Reader is created.
      with mock.patch(
          "cartopy.io.shapereader.Reader.__init__", return_value=None
      ) as counter:
          ax2 = fig.add_subplot(2, 1, 1, projection=ccrs.Robinson())
          ax2.coastlines()
          fig.canvas.draw()
      counter.assert_not_called()
  
file_path: cartopy/lib/cartopy/tests/mpl/test_caching.py
imports: import gc
  from unittest import mock
  import matplotlib.pyplot
  import numpy
  import pytest
  import cartopy.crs
  from cartopy.tests.conftest import _HAS_PYKDTREE_OR_SCIPY
  import cartopy.io.shapereader
  from cartopy.mpl import _MPL_38
  from cartopy.mpl.feature_artist import FeatureArtist
  import cartopy.mpl.geoaxes
  import cartopy.mpl.patch
label_desc: Use image node_id 2 for calling a global function with example usage: test_coastline_loading_cache() without return types