mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable'
This commit is contained in:
@@ -4,4 +4,5 @@
|
||||
:toctree:
|
||||
|
||||
dummy_module
|
||||
underscore_module_
|
||||
sphinx
|
||||
|
||||
12
tests/roots/test-autosummary/underscore_module_.py
Normal file
12
tests/roots/test-autosummary/underscore_module_.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""
|
||||
module with trailing underscores everywhere
|
||||
"""
|
||||
class class_(object):
|
||||
""" Class """
|
||||
def method_(_arg):
|
||||
""" Method """
|
||||
pass
|
||||
|
||||
def function_(_arg):
|
||||
""" Function """
|
||||
pass
|
||||
2
tests/roots/test-toctree-empty/_templates/localtoc.html
Normal file
2
tests/roots/test-toctree-empty/_templates/localtoc.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{# This will call toctree unconditionally, whether there is a local or global toc #}
|
||||
{{ toctree() }}
|
||||
6
tests/roots/test-toctree-empty/conf.py
Normal file
6
tests/roots/test-toctree-empty/conf.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
master_doc = 'index'
|
||||
html_theme = 'classic'
|
||||
exclude_patterns = ['_build']
|
||||
templates_path = ['_templates']
|
||||
4
tests/roots/test-toctree-empty/index.rst
Normal file
4
tests/roots/test-toctree-empty/index.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
test-toctree-empty
|
||||
==================
|
||||
|
||||
.. toctree::
|
||||
@@ -13,6 +13,8 @@ from six import iteritems, StringIO
|
||||
|
||||
from sphinx.ext.autosummary import mangle_signature
|
||||
|
||||
from util import etree_parse
|
||||
|
||||
import pytest
|
||||
|
||||
html_warnfile = StringIO()
|
||||
@@ -103,3 +105,24 @@ def test_get_items_summary(app, status, warning):
|
||||
'Test function take an argument ended with underscore.',
|
||||
'dummy_module.func')
|
||||
assert autosummary_items['func'] == func_attrs
|
||||
|
||||
def str_content(elem):
|
||||
if elem.text is not None:
|
||||
return elem.text
|
||||
else:
|
||||
return ''.join(str_content(e) for e in elem)
|
||||
|
||||
@pytest.mark.sphinx('xml', **default_kw)
|
||||
def test_escaping(app, status, warning):
|
||||
from xml.etree import ElementTree
|
||||
|
||||
app.builder.build_all()
|
||||
|
||||
outdir = app.builder.outdir
|
||||
|
||||
docpage = outdir / 'underscore_module_.xml'
|
||||
assert docpage.exists()
|
||||
|
||||
title = etree_parse(docpage).find('section/title')
|
||||
|
||||
assert str_content(title) == 'underscore_module_'
|
||||
|
||||
@@ -26,3 +26,12 @@ def test_relations(app, status, warning):
|
||||
assert app.builder.relations['qux/qux_1'] == ['qux/index', 'qux/index', 'qux/qux_2']
|
||||
assert app.builder.relations['qux/qux_2'] == ['qux/index', 'qux/qux_1', None]
|
||||
assert 'quux' not in app.builder.relations
|
||||
|
||||
|
||||
@pytest.mark.sphinx('singlehtml', testroot='toctree-empty')
|
||||
def test_singlehtml_toctree(app, status, warning):
|
||||
app.builder.build_all()
|
||||
try:
|
||||
app.builder._get_local_toctree('index')
|
||||
except AttributeError:
|
||||
pytest.fail('Unexpected AttributeError in app.builder.fix_refuris')
|
||||
|
||||
Reference in New Issue
Block a user