mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-08-12 05:54:50 -05:00
Consistently name the object description options (#11533)
* The directive option ``:noindex:`` was renamed to ``:no-index:``. * The directive option ``:noindexentry:`` was renamed to ``:no-index-entry:``. * The directive option ``:nocontentsentry:`` was renamed to ``:no-contents-entry:``. The previous names are retained as aliases, but will be deprecated and removed in a future version of Sphinx (9.0 or later).
This commit is contained in:
@@ -8,7 +8,7 @@ Testing object descriptions
|
||||
.. function:: func_without_body()
|
||||
|
||||
.. function:: func_noindex
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
.. function:: func_with_module
|
||||
:module: foolib
|
||||
|
||||
@@ -176,7 +176,7 @@ The section with an object description
|
||||
======================================
|
||||
|
||||
.. py:function:: dummy(N)
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
Footnotes referred twice
|
||||
========================
|
||||
|
||||
@@ -6,14 +6,14 @@ i18n with docfields
|
||||
.. single TypedField
|
||||
|
||||
.. class:: Cls1
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
:param param: description of parameter param
|
||||
|
||||
.. grouped TypedFields
|
||||
|
||||
.. class:: Cls2
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
:param foo: description of parameter foo
|
||||
:param bar: description of parameter bar
|
||||
@@ -22,14 +22,14 @@ i18n with docfields
|
||||
.. single GroupedField
|
||||
|
||||
.. class:: Cls3(values)
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
:raises ValueError: if the values are out of range
|
||||
|
||||
.. grouped GroupedFields
|
||||
|
||||
.. class:: Cls4(values)
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
:raises TypeError: if the values are not valid
|
||||
:raises ValueError: if the values are out of range
|
||||
@@ -38,7 +38,7 @@ i18n with docfields
|
||||
.. single Field
|
||||
|
||||
.. class:: Cls5
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
:returns: a new :class:`Cls3` instance
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Testing object descriptions
|
||||
:FIELd_name PARTial caps:
|
||||
|
||||
.. function:: func_noindex
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
.. function:: func_with_module
|
||||
:module: foolib
|
||||
|
||||
@@ -2,7 +2,7 @@ test-warnings
|
||||
=============
|
||||
|
||||
.. automodule:: autodoc_fodder
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
.. autoclass:: MarkupError
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from sphinx.testing import restructuredtext
|
||||
from sphinx.testing.util import assert_node
|
||||
|
||||
DOMAINS = [
|
||||
# directive, noindex, noindexentry, signature of f, signature of g, index entry of g
|
||||
# directive, no-index, no-index-entry, signature of f, signature of g, index entry of g
|
||||
('c:function', False, True, 'void f()', 'void g()', ('single', 'g (C function)', 'c.g', '', None)),
|
||||
('cpp:function', False, True, 'void f()', 'void g()', ('single', 'g (C++ function)', '_CPPv41gv', '', None)),
|
||||
('js:function', True, True, 'f()', 'g()', ('single', 'g() (built-in function)', 'g', '', None)),
|
||||
@@ -19,16 +19,16 @@ DOMAINS = [
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :no-typesetting:\n')
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, nodes.target))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_twice(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_twice(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :no-typesetting:\n'
|
||||
f'.. {directive}:: {sig_g}\n'
|
||||
@@ -38,24 +38,24 @@ def test_object_description_no_typesetting_twice(app, directive, noindex, noinde
|
||||
assert_node(doctree, (addnodes.index, addnodes.index, nodes.target, nodes.target))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_noindex_orig(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
if not noindex:
|
||||
pytest.skip(f'{directive} does not support :noindex: option')
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_noindex_orig(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
if not no_index:
|
||||
pytest.skip(f'{directive} does not support :no-index: option')
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :noindex:\n'
|
||||
f' :no-index:\n'
|
||||
f'.. {directive}:: {sig_g}\n')
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, addnodes.desc, addnodes.index, addnodes.desc))
|
||||
assert_node(doctree[2], addnodes.index, entries=[index_g])
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_noindex(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
if not noindex:
|
||||
pytest.skip(f'{directive} does not support :noindex: option')
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_noindex(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
if not no_index:
|
||||
pytest.skip(f'{directive} does not support :no-index: option')
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :noindex:\n'
|
||||
f' :no-index:\n'
|
||||
f' :no-typesetting:\n'
|
||||
f'.. {directive}:: {sig_g}\n'
|
||||
f' :no-typesetting:\n')
|
||||
@@ -65,12 +65,12 @@ def test_object_description_no_typesetting_noindex(app, directive, noindex, noin
|
||||
assert_node(doctree[1], addnodes.index, entries=[index_g])
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_noindexentry(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
if not noindexentry:
|
||||
pytest.skip(f'{directive} does not support :noindexentry: option')
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_no_index_entry(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
if not no_index_entry:
|
||||
pytest.skip(f'{directive} does not support :no-index-entry: option')
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :noindexentry:\n'
|
||||
f' :no-index-entry:\n'
|
||||
f' :no-typesetting:\n'
|
||||
f'.. {directive}:: {sig_g}\n'
|
||||
f' :no-typesetting:\n')
|
||||
@@ -80,8 +80,8 @@ def test_object_description_no_typesetting_noindexentry(app, directive, noindex,
|
||||
assert_node(doctree[1], addnodes.index, entries=[index_g])
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_code(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_code(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :no-typesetting:\n'
|
||||
f'.. {directive}:: {sig_g}\n'
|
||||
@@ -94,8 +94,8 @@ def test_object_description_no_typesetting_code(app, directive, noindex, noindex
|
||||
assert_node(doctree, (addnodes.index, addnodes.index, nodes.target, nodes.target, nodes.literal_block))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('directive', 'noindex', 'noindexentry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_heading(app, directive, noindex, noindexentry, sig_f, sig_g, index_g):
|
||||
@pytest.mark.parametrize(('directive', 'no_index', 'no_index_entry', 'sig_f', 'sig_g', 'index_g'), DOMAINS)
|
||||
def test_object_description_no_typesetting_heading(app, directive, no_index, no_index_entry, sig_f, sig_g, index_g):
|
||||
text = (f'.. {directive}:: {sig_f}\n'
|
||||
f' :no-typesetting:\n'
|
||||
f'.. {directive}:: {sig_g}\n'
|
||||
|
||||
+12
-12
@@ -792,7 +792,7 @@ def test_domain_c_parse_cfunction(app):
|
||||
"PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
|
||||
entry = _get_obj(app, 'PyType_GenericAlloc')
|
||||
assert entry == ('index', 'c.PyType_GenericAlloc', 'function')
|
||||
@@ -802,7 +802,7 @@ def test_domain_c_parse_cmember(app):
|
||||
text = ".. c:member:: PyObject* PyTypeObject.tp_bases"
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree[1], addnodes.desc, desctype="member",
|
||||
domain="c", objtype="member", noindex=False)
|
||||
domain="c", objtype="member", no_index=False)
|
||||
|
||||
entry = _get_obj(app, 'PyTypeObject.tp_bases')
|
||||
assert entry == ('index', 'c.PyTypeObject.tp_bases', 'member')
|
||||
@@ -812,16 +812,16 @@ def test_domain_c_parse_cvar(app):
|
||||
text = ".. c:var:: PyObject* PyClass_Type"
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree[1], addnodes.desc, desctype="var",
|
||||
domain="c", objtype="var", noindex=False)
|
||||
domain="c", objtype="var", no_index=False)
|
||||
|
||||
entry = _get_obj(app, 'PyClass_Type')
|
||||
assert entry == ('index', 'c.PyClass_Type', 'member')
|
||||
|
||||
|
||||
def test_domain_c_parse_noindexentry(app):
|
||||
def test_domain_c_parse_no_index_entry(app):
|
||||
text = (".. c:function:: void f()\n"
|
||||
".. c:function:: void g()\n"
|
||||
" :noindexentry:\n")
|
||||
" :no-index-entry:\n")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, desc, addnodes.index, desc))
|
||||
assert_node(doctree[0], addnodes.index, entries=[('single', 'f (C function)', 'c.f', '', None)])
|
||||
@@ -849,7 +849,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_equal(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
@@ -880,7 +880,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_force_single(a
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
@@ -910,7 +910,7 @@ def test_cfunction_signature_with_c_maximum_signature_line_length_break(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
@@ -940,7 +940,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_equal(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
@@ -971,7 +971,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_force_single(app
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
@@ -1001,7 +1001,7 @@ def test_cfunction_signature_with_maximum_signature_line_length_break(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="c", objtype="function", noindex=False)
|
||||
domain="c", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
@@ -1032,7 +1032,7 @@ def test_c_maximum_signature_line_length_overrides_global(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='c', objtype='function', noindex=False)
|
||||
domain='c', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, "str"]],
|
||||
desc_sig_space,
|
||||
|
||||
@@ -1425,10 +1425,10 @@ _var cpp:member 1 index.html#_CPPv44$ -
|
||||
assert len(ws) == 0
|
||||
|
||||
|
||||
def test_domain_cpp_parse_noindexentry(app):
|
||||
def test_domain_cpp_parse_no_index_entry(app):
|
||||
text = (".. cpp:function:: void f()\n"
|
||||
".. cpp:function:: void g()\n"
|
||||
" :noindexentry:\n")
|
||||
" :no-index-entry:\n")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, desc, addnodes.index, desc))
|
||||
assert_node(doctree[0], addnodes.index, entries=[('single', 'f (C++ function)', '_CPPv41fv', '', None)])
|
||||
@@ -1521,7 +1521,7 @@ def test_cpp_function_signature_with_cpp_maximum_signature_line_length_equal(app
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
@@ -1552,7 +1552,7 @@ def test_cpp_function_signature_with_cpp_maximum_signature_line_length_force_sin
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
@@ -1582,7 +1582,7 @@ def test_cpp_function_signature_with_cpp_maximum_signature_line_length_break(app
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
@@ -1612,7 +1612,7 @@ def test_cpp_function_signature_with_maximum_signature_line_length_equal(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
@@ -1643,7 +1643,7 @@ def test_cpp_function_signature_with_maximum_signature_line_length_force_single(
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
@@ -1673,7 +1673,7 @@ def test_cpp_function_signature_with_maximum_signature_line_length_break(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
@@ -1698,7 +1698,7 @@ def test_cpp_maximum_signature_line_length_overrides_global(app):
|
||||
desc_content)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype='function',
|
||||
domain='cpp', objtype='function', noindex=False)
|
||||
domain='cpp', objtype='function', no_index=False)
|
||||
assert_node(doctree[1][0][0][3], [desc_parameterlist, desc_parameter, (
|
||||
[pending_xref, [desc_sig_name, 'str']],
|
||||
desc_sig_space,
|
||||
|
||||
+12
-12
@@ -195,7 +195,7 @@ def test_js_function(app):
|
||||
[desc_parameter, ([desc_sig_name, "b"])])])
|
||||
assert_node(doctree[0], addnodes.index,
|
||||
entries=[("single", "sum() (built-in function)", "sum", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, domain="js", objtype="function", noindex=False)
|
||||
assert_node(doctree[1], addnodes.desc, domain="js", objtype="function", no_index=False)
|
||||
|
||||
|
||||
def test_js_class(app):
|
||||
@@ -209,7 +209,7 @@ def test_js_class(app):
|
||||
[desc_content, ()])]))
|
||||
assert_node(doctree[0], addnodes.index,
|
||||
entries=[("single", "Application() (class)", "Application", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, domain="js", objtype="class", noindex=False)
|
||||
assert_node(doctree[1], addnodes.desc, domain="js", objtype="class", no_index=False)
|
||||
|
||||
|
||||
def test_js_data(app):
|
||||
@@ -220,13 +220,13 @@ def test_js_data(app):
|
||||
[desc_content, ()])]))
|
||||
assert_node(doctree[0], addnodes.index,
|
||||
entries=[("single", "name (global variable or constant)", "name", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, domain="js", objtype="data", noindex=False)
|
||||
assert_node(doctree[1], addnodes.desc, domain="js", objtype="data", no_index=False)
|
||||
|
||||
|
||||
def test_noindexentry(app):
|
||||
def test_no_index_entry(app):
|
||||
text = (".. js:function:: f()\n"
|
||||
".. js:function:: g()\n"
|
||||
" :noindexentry:\n")
|
||||
" :no-index-entry:\n")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, desc, addnodes.index, desc))
|
||||
assert_node(doctree[0], addnodes.index, entries=[('single', 'f() (built-in function)', 'f', '', None)])
|
||||
@@ -262,7 +262,7 @@ def test_jsfunction_signature_with_javascript_maximum_signature_line_length_equa
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "name"])])
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=False)
|
||||
@@ -286,7 +286,7 @@ def test_jsfunction_signature_with_javascript_maximum_signature_line_length_forc
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "names"])])
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=False)
|
||||
@@ -309,7 +309,7 @@ def test_jsfunction_signature_with_javascript_maximum_signature_line_length_brea
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "names"])])
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=True)
|
||||
@@ -332,7 +332,7 @@ def test_jsfunction_signature_with_maximum_signature_line_length_equal(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "name"])])
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=False)
|
||||
@@ -356,7 +356,7 @@ def test_jsfunction_signature_with_maximum_signature_line_length_force_single(ap
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "names"])])
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=False)
|
||||
@@ -379,7 +379,7 @@ def test_jsfunction_signature_with_maximum_signature_line_length_break(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "names"])])
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=True)
|
||||
@@ -401,7 +401,7 @@ def test_javascript_maximum_signature_line_length_overrides_global(app):
|
||||
desc_content)])
|
||||
assert_node(doctree, expected_doctree)
|
||||
assert_node(doctree[1], desc, desctype="function",
|
||||
domain="js", objtype="function", noindex=False)
|
||||
domain="js", objtype="function", no_index=False)
|
||||
expected_sig = [desc_parameterlist, desc_parameter, [desc_sig_name, "name"]]
|
||||
assert_node(doctree[1][0][1], expected_sig)
|
||||
assert_node(doctree[1][0][1], desc_parameterlist, multi_line_parameter_list=False)
|
||||
|
||||
+19
-19
@@ -420,7 +420,7 @@ def test_pyfunction_signature(app):
|
||||
[desc_returns, pending_xref, "str"])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, desc_parameter, ([desc_sig_name, "name"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -438,7 +438,7 @@ def test_pyfunction_signature_full(app):
|
||||
[desc_returns, pending_xref, "str"])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, ([desc_parameter, ([desc_sig_name, "a"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -569,7 +569,7 @@ def test_optional_pyfunction_signature(app):
|
||||
[desc_returns, pending_xref, "ast object"])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1],
|
||||
([desc_parameter, ([desc_sig_name, "source"])],
|
||||
[desc_optional, ([desc_parameter, ([desc_sig_name, "filename"])],
|
||||
@@ -585,7 +585,7 @@ def test_pyexception_signature(app):
|
||||
[desc_name, "IOError"])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], desc, desctype="exception",
|
||||
domain="py", objtype="exception", noindex=False)
|
||||
domain="py", objtype="exception", no_index=False)
|
||||
|
||||
|
||||
def test_pydata_signature(app):
|
||||
@@ -606,7 +606,7 @@ def test_pydata_signature(app):
|
||||
)],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="data",
|
||||
domain="py", objtype="data", noindex=False)
|
||||
domain="py", objtype="data", no_index=False)
|
||||
|
||||
|
||||
def test_pydata_signature_old(app):
|
||||
@@ -619,7 +619,7 @@ def test_pydata_signature_old(app):
|
||||
"= 1")])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="data",
|
||||
domain="py", objtype="data", noindex=False)
|
||||
domain="py", objtype="data", no_index=False)
|
||||
|
||||
|
||||
def test_pydata_with_union_type_operator(app):
|
||||
@@ -959,7 +959,7 @@ def test_pydecorator_signature(app):
|
||||
[desc_name, "deco"])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
|
||||
assert 'deco' in domain.objects
|
||||
assert domain.objects['deco'] == ('index', 'deco', 'function', False)
|
||||
@@ -974,7 +974,7 @@ def test_pydecoratormethod_signature(app):
|
||||
[desc_name, "deco"])],
|
||||
desc_content)]))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="method",
|
||||
domain="py", objtype="method", noindex=False)
|
||||
domain="py", objtype="method", no_index=False)
|
||||
|
||||
assert 'deco' in domain.objects
|
||||
assert domain.objects['deco'] == ('index', 'deco', 'method', False)
|
||||
@@ -1401,10 +1401,10 @@ def test_modindex_common_prefix(app):
|
||||
)
|
||||
|
||||
|
||||
def test_noindexentry(app):
|
||||
def test_no_index_entry(app):
|
||||
text = (".. py:function:: f()\n"
|
||||
".. py:function:: g()\n"
|
||||
" :noindexentry:\n")
|
||||
" :no-index-entry:\n")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, desc, addnodes.index, desc))
|
||||
assert_node(doctree[0], addnodes.index, entries=[('pair', 'built-in function; f()', 'f', '', None)])
|
||||
@@ -1412,7 +1412,7 @@ def test_noindexentry(app):
|
||||
|
||||
text = (".. py:class:: f\n"
|
||||
".. py:class:: g\n"
|
||||
" :noindexentry:\n")
|
||||
" :no-index-entry:\n")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree, (addnodes.index, desc, addnodes.index, desc))
|
||||
assert_node(doctree[0], addnodes.index, entries=[('single', 'f (built-in class)', 'f', '', None)])
|
||||
@@ -1456,7 +1456,7 @@ def test_warn_missing_reference(app, status, warning):
|
||||
@pytest.mark.parametrize('include_options', (True, False))
|
||||
def test_signature_line_number(app, include_options):
|
||||
text = (".. py:function:: foo(bar : string)\n" +
|
||||
(" :noindexentry:\n" if include_options else ""))
|
||||
(" :no-index-entry:\n" if include_options else ""))
|
||||
doc = restructuredtext.parse(app, text)
|
||||
xrefs = list(doc.findall(condition=addnodes.pending_xref))
|
||||
assert len(xrefs) == 1
|
||||
@@ -1483,7 +1483,7 @@ def test_pyfunction_signature_with_python_maximum_signature_line_length_equal(ap
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1], [desc_parameterlist, desc_parameter, (
|
||||
[desc_sig_name, "name"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -1512,7 +1512,7 @@ def test_pyfunction_signature_with_python_maximum_signature_line_length_force_si
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1], [desc_parameterlist, desc_parameter, (
|
||||
[desc_sig_name, "names"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -1540,7 +1540,7 @@ def test_pyfunction_signature_with_python_maximum_signature_line_length_break(ap
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1], [desc_parameterlist, desc_parameter, (
|
||||
[desc_sig_name, "names"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -1568,7 +1568,7 @@ def test_pyfunction_signature_with_maximum_signature_line_length_equal(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1], [desc_parameterlist, desc_parameter, (
|
||||
[desc_sig_name, "name"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -1597,7 +1597,7 @@ def test_pyfunction_signature_with_maximum_signature_line_length_force_single(ap
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1], [desc_parameterlist, desc_parameter, (
|
||||
[desc_sig_name, "names"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -1625,7 +1625,7 @@ def test_pyfunction_signature_with_maximum_signature_line_length_break(app):
|
||||
)],
|
||||
))
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
assert_node(doctree[1][0][1], [desc_parameterlist, desc_parameter, (
|
||||
[desc_sig_name, "names"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
@@ -1652,7 +1652,7 @@ def test_python_maximum_signature_line_length_overrides_global(app):
|
||||
desc_content)])
|
||||
assert_node(doctree, expected_doctree)
|
||||
assert_node(doctree[1], addnodes.desc, desctype="function",
|
||||
domain="py", objtype="function", noindex=False)
|
||||
domain="py", objtype="function", no_index=False)
|
||||
signame_node = [desc_sig_name, "name"]
|
||||
expected_sig = [desc_parameterlist, desc_parameter, (signame_node,
|
||||
[desc_sig_punctuation, ":"],
|
||||
|
||||
@@ -38,7 +38,7 @@ def test_rst_directive(app):
|
||||
assert_node(doctree[0],
|
||||
entries=[("single", "toctree (directive)", "directive-toctree", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="directive",
|
||||
domain="rst", objtype="directive", noindex=False)
|
||||
domain="rst", objtype="directive", no_index=False)
|
||||
|
||||
# decorated
|
||||
text = ".. rst:directive:: .. toctree::"
|
||||
@@ -49,7 +49,7 @@ def test_rst_directive(app):
|
||||
assert_node(doctree[0],
|
||||
entries=[("single", "toctree (directive)", "directive-toctree", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="directive",
|
||||
domain="rst", objtype="directive", noindex=False)
|
||||
domain="rst", objtype="directive", no_index=False)
|
||||
|
||||
|
||||
def test_rst_directive_with_argument(app):
|
||||
@@ -62,7 +62,7 @@ def test_rst_directive_with_argument(app):
|
||||
assert_node(doctree[0],
|
||||
entries=[("single", "toctree (directive)", "directive-toctree", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="directive",
|
||||
domain="rst", objtype="directive", noindex=False)
|
||||
domain="rst", objtype="directive", no_index=False)
|
||||
|
||||
|
||||
def test_rst_directive_option(app):
|
||||
@@ -75,7 +75,7 @@ def test_rst_directive_option(app):
|
||||
entries=[("single", ":foo: (directive option)",
|
||||
"directive-option-foo", "", "F")])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="directive:option",
|
||||
domain="rst", objtype="directive:option", noindex=False)
|
||||
domain="rst", objtype="directive:option", no_index=False)
|
||||
|
||||
|
||||
def test_rst_directive_option_with_argument(app):
|
||||
@@ -89,7 +89,7 @@ def test_rst_directive_option_with_argument(app):
|
||||
entries=[("single", ":foo: (directive option)",
|
||||
"directive-option-foo", "", "F")])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="directive:option",
|
||||
domain="rst", objtype="directive:option", noindex=False)
|
||||
domain="rst", objtype="directive:option", no_index=False)
|
||||
|
||||
|
||||
def test_rst_directive_option_type(app):
|
||||
@@ -104,7 +104,7 @@ def test_rst_directive_option_type(app):
|
||||
entries=[("single", ":foo: (directive option)",
|
||||
"directive-option-foo", "", "F")])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="directive:option",
|
||||
domain="rst", objtype="directive:option", noindex=False)
|
||||
domain="rst", objtype="directive:option", no_index=False)
|
||||
|
||||
|
||||
def test_rst_directive_and_directive_option(app):
|
||||
@@ -122,7 +122,7 @@ def test_rst_directive_and_directive_option(app):
|
||||
assert_node(doctree[1][1][1], ([desc_signature, desc_name, ":bar:"],
|
||||
[desc_content, ()]))
|
||||
assert_node(doctree[1][1][1], addnodes.desc, desctype="directive:option",
|
||||
domain="rst", objtype="directive:option", noindex=False)
|
||||
domain="rst", objtype="directive:option", no_index=False)
|
||||
|
||||
|
||||
def test_rst_role(app):
|
||||
@@ -134,4 +134,4 @@ def test_rst_role(app):
|
||||
assert_node(doctree[0],
|
||||
entries=[("single", "ref (role)", "role-ref", "", None)])
|
||||
assert_node(doctree[1], addnodes.desc, desctype="role",
|
||||
domain="rst", objtype="role", noindex=False)
|
||||
domain="rst", objtype="role", no_index=False)
|
||||
|
||||
@@ -48,7 +48,7 @@ def make_directive_bridge(env):
|
||||
special_members = False,
|
||||
imported_members = False,
|
||||
show_inheritance = False,
|
||||
noindex = False,
|
||||
no_index = False,
|
||||
annotation = None,
|
||||
synopsis = '',
|
||||
platform = '',
|
||||
@@ -925,22 +925,22 @@ def test_autodoc_ignore_module_all(app):
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||
def test_autodoc_noindex(app):
|
||||
options = {"noindex": None}
|
||||
options = {"no-index": None}
|
||||
actual = do_autodoc(app, 'module', 'target', options)
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:module:: target',
|
||||
' :noindex:',
|
||||
' :no-index:',
|
||||
'',
|
||||
]
|
||||
|
||||
# TODO: :noindex: should be propagated to children of target item.
|
||||
# TODO: :no-index: should be propagated to children of target item.
|
||||
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:class:: Base()',
|
||||
' :noindex:',
|
||||
' :no-index:',
|
||||
' :module: target.inheritance',
|
||||
'',
|
||||
]
|
||||
|
||||
@@ -1162,19 +1162,19 @@ Methods:
|
||||
|
||||
expected = """
|
||||
.. attribute:: arg
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
description
|
||||
|
||||
.. method:: func(i, j)
|
||||
:noindex:
|
||||
:no-index:
|
||||
|
||||
|
||||
description
|
||||
""" # noqa: W293
|
||||
config = Config()
|
||||
actual = str(GoogleDocstring(docstring, config=config, app=None, what='module',
|
||||
options={'noindex': True}))
|
||||
options={'no-index': True}))
|
||||
assert expected == actual
|
||||
|
||||
def test_keywords_with_types(self):
|
||||
|
||||
Reference in New Issue
Block a user