summaryrefslogtreecommitdiffstats
path: root/tests/test_extensions/test_ext_graphviz.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_extensions/test_ext_graphviz.py (renamed from tests/test_ext_graphviz.py)44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/test_ext_graphviz.py b/tests/test_extensions/test_ext_graphviz.py
index d63dc2a..866a92a 100644
--- a/tests/test_ext_graphviz.py
+++ b/tests/test_extensions/test_ext_graphviz.py
@@ -11,40 +11,40 @@ from sphinx.ext.graphviz import ClickableMapDefinition
@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()
+ app.build(force_all=True)
content = (app.outdir / 'index.html').read_text(encoding='utf8')
html = (r'<figure class="align-default" .*?>\s*'
r'<div class="graphviz"><img .*?/></div>\s*<figcaption>\s*'
r'<p><span class="caption-text">caption of graph</span>.*</p>\s*'
r'</figcaption>\s*</figure>')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = 'Hello <div class="graphviz"><img .*?/></div>\n graphviz world'
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = ('<img src=".*?" alt="digraph foo {\nbaz -&gt; qux\n}" '
'class="graphviz neato-graph" />')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = (r'<figure class="align-right" .*?>\s*'
r'<div class="graphviz"><img .*?/></div>\s*<figcaption>\s*'
r'<p><span class="caption-text">on <em>right</em></span>.*</p>\s*'
r'</figcaption>\s*</figure>')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = (r'<div align=\"center\" class=\"align-center\">'
r'<div class="graphviz"><img src=\".*\.png\" alt=\"digraph foo {\n'
r'centered\n'
r'}\" class="graphviz" /></div>\n</div>')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
@pytest.mark.sphinx('html', testroot='ext-graphviz',
confoverrides={'graphviz_output_format': 'svg'})
@pytest.mark.usefixtures('if_graphviz_found')
def test_graphviz_svg_html(app, status, warning):
- app.builder.build_all()
+ app.build(force_all=True)
content = (app.outdir / 'index.html').read_text(encoding='utf8')
@@ -57,12 +57,12 @@ def test_graphviz_svg_html(app, status, warning):
r'<p><span class=\"caption-text\">caption of graph</span>.*</p>\n'
r'</figcaption>\n'
r'</figure>')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = (r'Hello <div class="graphviz"><object.*>\n'
r'\s*<p class=\"warning\">graph</p></object></div>\n'
r' graphviz world')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = (r'<figure class=\"align-right\" .*\>\n'
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
@@ -73,7 +73,7 @@ def test_graphviz_svg_html(app, status, warning):
r'<p><span class=\"caption-text\">on <em>right</em></span>.*</p>\n'
r'</figcaption>\n'
r'</figure>')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
html = (r'<div align=\"center\" class=\"align-center\">'
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
@@ -81,10 +81,10 @@ def test_graphviz_svg_html(app, status, warning):
r'centered\n'
r'}</p></object></div>\n'
r'</div>')
- assert re.search(html, content, re.S)
+ assert re.search(html, content, re.DOTALL)
image_re = r'.*data="([^"]+)".*?digraph test'
- image_path_match = re.search(image_re, content, re.S)
+ image_path_match = re.search(image_re, content, re.DOTALL)
assert image_path_match
image_path = image_path_match.group(1)
@@ -103,37 +103,37 @@ def test_graphviz_svg_html(app, status, warning):
@pytest.mark.sphinx('latex', testroot='ext-graphviz')
@pytest.mark.usefixtures('if_graphviz_found')
def test_graphviz_latex(app, status, warning):
- app.builder.build_all()
+ app.build(force_all=True)
content = (app.outdir / 'python.tex').read_text(encoding='utf8')
macro = ('\\\\begin{figure}\\[htbp\\]\n\\\\centering\n\\\\capstart\n\n'
'\\\\sphinxincludegraphics\\[\\]{graphviz-\\w+.pdf}\n'
'\\\\caption{caption of graph}\\\\label{.*}\\\\end{figure}')
- assert re.search(macro, content, re.S)
+ assert re.search(macro, content, re.DOTALL)
macro = 'Hello \\\\sphinxincludegraphics\\[\\]{graphviz-\\w+.pdf} graphviz world'
- assert re.search(macro, content, re.S)
+ assert re.search(macro, content, re.DOTALL)
macro = ('\\\\begin{wrapfigure}{r}{0pt}\n\\\\centering\n'
'\\\\sphinxincludegraphics\\[\\]{graphviz-\\w+.pdf}\n'
'\\\\caption{on \\\\sphinxstyleemphasis{right}}'
'\\\\label{.*}\\\\end{wrapfigure}')
- assert re.search(macro, content, re.S)
+ assert re.search(macro, content, re.DOTALL)
macro = (r'\{\\hfill'
r'\\sphinxincludegraphics\[\]{graphviz-.*}'
r'\\hspace\*{\\fill}}')
- assert re.search(macro, content, re.S)
+ assert re.search(macro, content, re.DOTALL)
@pytest.mark.sphinx('html', testroot='ext-graphviz', confoverrides={'language': 'xx'})
@pytest.mark.usefixtures('if_graphviz_found')
def test_graphviz_i18n(app, status, warning):
- app.builder.build_all()
+ app.build(force_all=True)
content = (app.outdir / 'index.html').read_text(encoding='utf8')
html = '<img src=".*?" alt="digraph {\n BAR -&gt; BAZ\n}" class="graphviz" />'
- assert re.search(html, content, re.M)
+ assert re.search(html, content, re.MULTILINE)
def test_graphviz_parse_mapfile():
@@ -150,17 +150,17 @@ def test_graphviz_parse_mapfile():
# normal graph
code = ('digraph {\n'
- ' foo [href="http://www.google.com/"];\n'
+ ' foo [href="https://www.google.com/"];\n'
' foo -> bar;\n'
'}\n')
content = ('<map id="%3" name="%3">\n'
- '<area shape="poly" id="node1" href="http://www.google.com/" title="foo" alt=""'
+ '<area shape="poly" id="node1" href="https://www.google.com/" title="foo" alt=""'
' coords="77,29,76,22,70,15,62,10,52,7,41,5,30,7,20,10,12,15,7,22,5,29,7,37,12,'
'43,20,49,30,52,41,53,52,52,62,49,70,43,76,37"/>\n'
'</map>')
cmap = ClickableMapDefinition('dummy.map', content, code)
assert cmap.filename == 'dummy.map'
- assert cmap.id == 'grapviza4ccdd48ce'
+ assert cmap.id == 'grapvizff087ab863'
assert len(cmap.clickable) == 1
assert cmap.generate_clickable_map() == content.replace('%3', cmap.id)