mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #4701: viewcode: Misplaced `<div>` in viewcode html output
This commit is contained in:
@@ -38,6 +38,17 @@ def test_viewcode(app, status, warning):
|
||||
# the next assert fails, until the autodoc bug gets fixed
|
||||
assert result.count('this is the class attribute class_attr') == 2
|
||||
|
||||
result = (app.outdir / '_modules/spam/mod1.html').text(encoding='utf-8')
|
||||
result = re.sub('<span class=".*?">', '<span>', result) # filter pygments classes
|
||||
assert ('<div class="viewcode-block" id="Class1"><a class="viewcode-back" '
|
||||
'href="../../index.html#spam.Class1">[docs]</a>'
|
||||
'<span>@decorator</span>\n'
|
||||
'<span>class</span> <span>Class1</span>'
|
||||
'<span>(</span><span>object</span><span>):</span>\n'
|
||||
' <span>"""</span>\n'
|
||||
'<span> this is Class1</span>\n'
|
||||
'<span> """</span></div>\n') in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-viewcode', tags=['test_linkcode'])
|
||||
def test_linkcode(app, status, warning):
|
||||
|
||||
Reference in New Issue
Block a user