def test_figure_none_for_image_and_caption(self):
        image_object = None
        caption_object = None

        expected = ''

        result = html_string_builders.figure((image_object, caption_object))

        assert result == expected
    def test_figure_none_for_caption(self, processing_options):
        image_object = ImageEmbed(processing_options, "an image", "image.png", Path("image.pdf"), "200", "300")
        image_object.target_path = Path("image.png")
        caption_object = None

        expected = '<img src="image.png" alt="an image" width="200" height="300">'

        result = html_string_builders.figure((image_object, caption_object))

        assert result == expected
    def test_figure_none_for_image(self, processing_options):
        image_object = None

        caption_object = caption_object = Caption(processing_options, [TextItem(processing_options, "a caption")])

        expected = '<figure><figcaption>a caption</figcaption></figure>'

        result = html_string_builders.figure((image_object, caption_object))

        assert result == expected
    def test_figure(self, processing_options):
        image_object = ImageEmbed(processing_options, "an image", "image.png", Path("image.pdf"), "200", "300" )
        image_object.target_path = Path("image.png")
        caption_object = Caption(processing_options, [TextItem(processing_options, "a caption")])

        expected = '<figure><img src="image.png" alt="an image" width="200" height="300"><figcaption>a caption</figcaption></figure>'

        result = html_string_builders.figure((image_object, caption_object))

        assert result == expected
Exemplo n.º 5
0
 def html(self):
     return html_string_builders.figure(self.contents)