mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-08-14 06:54:43 -05:00
Add `:caption:` option for sphinx.ext.inheritance_diagram
This commit is contained in:
@@ -9,9 +9,31 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import re
|
||||
from util import with_app
|
||||
|
||||
|
||||
@with_app('html', testroot='ext-inheritance_diagram')
|
||||
def test_inheritance_diagram_html(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
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')
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user