"""
test_ext_graphviz
~~~~~~~~~~~~~~~~~
Test sphinx.ext.graphviz extension.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import pytest
from sphinx.ext.graphviz import ClickableMapDefinition
from sphinx.util import docutils
@pytest.mark.sphinx('html', testroot='ext-graphviz')
@pytest.mark.usefixtures('if_graphviz_found')
def test_graphviz_png_html(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'index.html').read_text()
if docutils.__version_info__ < (0, 17):
html = (r'
\s*'
r'
\s*
'
r'caption of graph.*
\s*
')
else:
html = (r'\s*'
r'
\s*\s*'
r'
caption of graph.*
\s*'
r'\s*')
assert re.search(html, content, re.S)
html = 'Hello
\n graphviz world'
assert re.search(html, content, re.S)
html = ('')
assert re.search(html, content, re.S)
if docutils.__version_info__ < (0, 17):
html = (r'
\s*'
r'
\s*
'
r'on right.*
\s*
')
else:
html = (r'\s*'
r'
\s*\s*'
r'
on right.*
\s*'
r'\s*')
assert re.search(html, content, re.S)
html = (r'