diff options
Diffstat (limited to 'tests/test_ext_inheritance_diagram.py')
-rw-r--r-- | tests/test_ext_inheritance_diagram.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/test_ext_inheritance_diagram.py b/tests/test_ext_inheritance_diagram.py index ad106e6c6..8456cda4a 100644 --- a/tests/test_ext_inheritance_diagram.py +++ b/tests/test_ext_inheritance_diagram.py @@ -19,14 +19,34 @@ from sphinx.ext.inheritance_diagram import InheritanceException, import_classes @pytest.mark.sphinx('html', testroot='ext-inheritance_diagram') @pytest.mark.usefixtures('if_graphviz_found') -def test_inheritance_diagram_html(app, status, warning): +def test_inheritance_diagram_png_html(app, status, warning): app.builder.build_all() content = (app.outdir / 'index.html').text() pattern = ('<div class="figure" id="id1">\n' + '<div class="graphviz">' '<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" ' - 'class="inheritance"/>\n<p class="caption"><span class="caption-text">' + 'class="inheritance"/></div>\n<p class="caption"><span class="caption-text">' + 'Test Foo!</span><a class="headerlink" href="#id1" ' + 'title="Permalink to this image">\xb6</a></p>') + assert re.search(pattern, content, re.M) + + +@pytest.mark.sphinx('html', testroot='ext-inheritance_diagram', + confoverrides={'graphviz_output_format': 'svg'}) +@pytest.mark.usefixtures('if_graphviz_found') +def test_inheritance_diagram_svg_html(app, status, warning): + app.builder.build_all() + + content = (app.outdir / 'index.html').text() + + pattern = ('<div class="figure" id="id1">\n' + '<div class="graphviz">' + '<object data="_images/inheritance-\\w+.svg" ' + 'type="image/svg\\+xml" class="inheritance">\n' + '<p class=\"warning\">Inheritance diagram of test.Foo</p>' + '</object></div>\n<p class="caption"><span class="caption-text">' 'Test Foo!</span><a class="headerlink" href="#id1" ' 'title="Permalink to this image">\xb6</a></p>') assert re.search(pattern, content, re.M) @@ -62,8 +82,9 @@ def test_inheritance_diagram_latex_alias(app, status, warning): content = (app.outdir / 'index.html').text() pattern = ('<div class="figure" id="id1">\n' + '<div class="graphviz">' '<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" ' - 'class="inheritance"/>\n<p class="caption"><span class="caption-text">' + 'class="inheritance"/></div>\n<p class="caption"><span class="caption-text">' 'Test Foo!</span><a class="headerlink" href="#id1" ' 'title="Permalink to this image">\xb6</a></p>') assert re.search(pattern, content, re.M) |