Esempio n. 1
0
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_equal(image_rst, single_image)
    assert_equal(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_equal(image_rst, image_list_rst)
    assert_equal(fig_num, 2)
Esempio n. 2
0
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