code: def test_saliency_maps(self):
      events = []
      original_gca = plt.gca
  
      def mocked_imshow(array, *args, **kwargs):
          events.append("imshow")
          self.assertEqual(array.shape, (28, 28))
  
      def mocked_show(*args, **kwargs):
          events.append("show")
  
      def mocked_gca(*args, **kwargs):
          events.append("gca")
          return original_gca()
  
      imshow_path = "matplotlib.axes.Axes.imshow"
      with mock.patch(imshow_path, side_effect=mocked_imshow):
          plots.saliency_map(
              self.network,
              self.image,
              mode="heatmap",
              show=False,
          )
          self.assertSequenceEqual(events, ["imshow"])
  
          plots.saliency_map(
              self.network,
              self.image,
              mode="raw",
              show=False,
          )
          self.assertSequenceEqual(events, ["imshow", "imshow"])
  
          with mock.patch(
              "matplotlib.pyplot.show", side_effect=mocked_show
          ):
              plots.saliency_map(self.network, self.image, show=True)
              self.assertSequenceEqual(
                  events, ["imshow", "imshow", "imshow", "show"]
              )
  
          with mock.patch(
              "matplotlib.pyplot.gca", side_effect=mocked_gca
          ):
              plots.saliency_map(self.network, self.image, show=False)
              self.assertSequenceEqual(
                  events,
                  [
                      "imshow",
                      "imshow",
                      "imshow",
                      "show",
                      "gca",
                      "imshow",
                  ],
              )
  
          optimizer = algorithms.GradientDescent(self.network)
          plots.saliency_map(optimizer, self.image, show=False)
  
file_path: neupy/tests/plots/test_saliency_map.py
imports: import mock
  import numpy
  import matplotlib.pyplot
  from neupy import plots, layers, algorithms
  from neupy.exceptions import InvalidConnection
  from base import BaseTestCase
label_desc: Use image node_id 6 for calling the SaliencyMapTestCase obj's underlying member method code with example usage: obj.test_saliency_maps() and returns: original_gca