2016-02-14 00:06:28 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
test_ext_inheritance_diagram
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Test sphinx.ext.inheritance_diagram extension.
|
|
|
|
|
|
|
|
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
|
|
|
|
:license: BSD, see LICENSE for details.
|
|
|
|
"""
|
|
|
|
|
2016-03-10 22:20:05 -06:00
|
|
|
import re
|
2016-02-14 00:06:28 -06:00
|
|
|
from util import with_app
|
2016-03-10 23:30:37 -06:00
|
|
|
from test_ext_graphviz import skip_if_graphviz_not_found
|
2016-02-14 00:06:28 -06:00
|
|
|
|
|
|
|
|
|
|
|
@with_app('html', testroot='ext-inheritance_diagram')
|
2016-03-10 23:30:37 -06:00
|
|
|
@skip_if_graphviz_not_found
|
2016-02-14 00:06:28 -06:00
|
|
|
def test_inheritance_diagram_html(app, status, warning):
|
|
|
|
app.builder.build_all()
|
2016-03-10 22:20:05 -06:00
|
|
|
|
|
|
|
content = (app.outdir / 'index.html').text()
|
|
|
|
|
|
|
|
pattern = ('<div class="figure" id="id1">\n'
|
|
|
|
'<img src="_images/inheritance-\w+.png" alt="Inheritance diagram of test.Foo" '
|
|
|
|
'class="inheritance"/>\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)
|
|
|
|
|
|
|
|
|
|
|
|
@with_app('latex', testroot='ext-inheritance_diagram')
|
2016-03-10 23:30:37 -06:00
|
|
|
@skip_if_graphviz_not_found
|
2016-03-10 22:20:05 -06:00
|
|
|
def test_inheritance_diagram_latex(app, status, warning):
|
|
|
|
app.builder.build_all()
|
|
|
|
|
|
|
|
content = (app.outdir / 'Python.tex').text()
|
|
|
|
|
|
|
|
pattern = ('\\\\begin{figure}\\[htbp]\n\\\\centering\n\\\\capstart\n\n'
|
|
|
|
'\\\\includegraphics{inheritance-\\w+.pdf}\n'
|
|
|
|
'\\\\caption{Test Foo!}\\\\label{index:id1}\\\\end{figure}')
|
|
|
|
assert re.search(pattern, content, re.M)
|