code: def test_figure_rst():
      """Testing rst of images"""
      figure_list = ["sphx_glr_plot_1.png"]
      image_rst, fig_num = sg.figure_rst(figure_list, ".")
      single_image = """
  .. image:: /sphx_glr_plot_1.png
      :align: center
  """
      assert image_rst == single_image
      assert fig_num == 1
  
      image_rst, fig_num = sg.figure_rst(
          figure_list + ["second.png"], "."
      )
  
      image_list_rst = """
  .. rst-class:: sphx-glr-horizontal
  
  
      *
  
        .. image:: /sphx_glr_plot_1.png
              :scale: 47
  
      *
  
        .. image:: /second.png
              :scale: 47
  """
      assert image_rst == image_list_rst
      assert fig_num == 2
  
      # test issue #229
      local_img = [os.path.join(os.getcwd(), "third.png")]
      image_rst, fig_num = sg.figure_rst(local_img, ".")
  
      single_image = sg.SINGLE_IMAGE % "third.png"
      assert image_rst == single_image
      assert fig_num == 1
  
imports: from __future__ import division, absolute_import, print_function, unicode_literals
  import ast
  import codecs
  import copy
  import logging
  import tempfile
  import re
  import os
  import shutil
  import zipfile
  import pytest
  import sphinx_gallery.gen_rst
  from sphinx_gallery import gen_gallery, downloads
  from sphinx_gallery.gen_gallery import generate_dir_rst
  from sphinx_gallery import sphinx_compatibility
  import matplotlib.pyplot
label_desc: Use image node_id 14 for calling a global function with example usage: test_figure_rst() without return types