mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add minimal test for descitems.
This commit is contained in:
parent
3a1af61b9f
commit
9f4be9b916
@ -199,6 +199,11 @@ class TextTranslator(nodes.NodeVisitor):
|
|||||||
def depart_desc_optional(self, node):
|
def depart_desc_optional(self, node):
|
||||||
self.add_text(']')
|
self.add_text(']')
|
||||||
|
|
||||||
|
def visit_desc_annotation(self, node):
|
||||||
|
pass
|
||||||
|
def depart_desc_annotation(self, node):
|
||||||
|
pass
|
||||||
|
|
||||||
def visit_refcount(self, node):
|
def visit_refcount(self, node):
|
||||||
pass
|
pass
|
||||||
def depart_refcount(self, node):
|
def depart_refcount(self, node):
|
||||||
|
@ -13,6 +13,7 @@ Contents:
|
|||||||
images
|
images
|
||||||
includes
|
includes
|
||||||
markup
|
markup
|
||||||
|
desc
|
||||||
math
|
math
|
||||||
autodoc
|
autodoc
|
||||||
|
|
||||||
|
60
tests/root/desc.txt
Normal file
60
tests/root/desc.txt
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
Testing description units
|
||||||
|
=========================
|
||||||
|
|
||||||
|
.. function:: func_without_module(a, b, *c[, d])
|
||||||
|
|
||||||
|
Does something.
|
||||||
|
|
||||||
|
.. function:: func_without_body()
|
||||||
|
|
||||||
|
.. function:: func_noindex
|
||||||
|
:noindex:
|
||||||
|
|
||||||
|
|
||||||
|
.. module:: mod
|
||||||
|
:synopsis: Module synopsis.
|
||||||
|
:platform: UNIX
|
||||||
|
|
||||||
|
.. function:: func_in_module
|
||||||
|
|
||||||
|
.. class:: Cls
|
||||||
|
|
||||||
|
.. method:: meth1
|
||||||
|
|
||||||
|
.. staticmethod:: meths
|
||||||
|
|
||||||
|
.. attribute:: attr
|
||||||
|
|
||||||
|
.. explicit class given
|
||||||
|
.. method:: Cls.meth2
|
||||||
|
|
||||||
|
.. explicit module given
|
||||||
|
.. exception:: Error(arg1, arg2)
|
||||||
|
:module: errmod
|
||||||
|
|
||||||
|
.. data:: var
|
||||||
|
|
||||||
|
|
||||||
|
.. currentmodule:: None
|
||||||
|
|
||||||
|
.. function:: func_without_module2() -> annotation
|
||||||
|
|
||||||
|
|
||||||
|
C items
|
||||||
|
=======
|
||||||
|
|
||||||
|
.. cfunction:: Sphinx_DoSomething()
|
||||||
|
|
||||||
|
.. cmember:: SphinxStruct.member
|
||||||
|
|
||||||
|
.. cmacro:: SPHINX_USE_PYTHON
|
||||||
|
|
||||||
|
.. ctype:: SphinxType
|
||||||
|
|
||||||
|
.. cvar:: sphinx_global
|
||||||
|
|
||||||
|
|
||||||
|
Testing references
|
||||||
|
==================
|
||||||
|
|
||||||
|
Referencing :class:`mod.Cls` or :Class:`mod.Cls` should be the same.
|
@ -103,6 +103,11 @@ Index markup
|
|||||||
triple: index; entry; triple
|
triple: index; entry; triple
|
||||||
|
|
||||||
|
|
||||||
|
Ö... Some strange characters
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Testing öäü...
|
||||||
|
|
||||||
|
|
||||||
.. rubric:: Footnotes
|
.. rubric:: Footnotes
|
||||||
|
|
||||||
|
@ -58,6 +58,11 @@ HTML_XPATH = {
|
|||||||
".//meta[@name='author'][@content='Me']": '',
|
".//meta[@name='author'][@content='Me']": '',
|
||||||
".//meta[@name='keywords'][@content='docs, sphinx']": '',
|
".//meta[@name='keywords'][@content='docs, sphinx']": '',
|
||||||
},
|
},
|
||||||
|
'desc.html': {
|
||||||
|
".//dt[@id='mod.Cls.meth1']": '',
|
||||||
|
".//dt[@id='errmod.Error']": '',
|
||||||
|
".//a[@href='#mod.Cls']": '',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
class NslessParser(ET.XMLParser):
|
class NslessParser(ET.XMLParser):
|
||||||
|
@ -80,3 +80,24 @@ def test_second_update():
|
|||||||
assert docnames == set(['contents', 'new'])
|
assert docnames == set(['contents', 'new'])
|
||||||
assert 'images' not in env.all_docs
|
assert 'images' not in env.all_docs
|
||||||
assert 'images' not in env.found_docs
|
assert 'images' not in env.found_docs
|
||||||
|
|
||||||
|
def test_object_inventory():
|
||||||
|
refs = env.descrefs
|
||||||
|
|
||||||
|
assert 'func_without_module' in refs
|
||||||
|
assert refs['func_without_module'] == ('desc', 'function')
|
||||||
|
assert 'func_without_module2' in refs
|
||||||
|
assert 'mod.func_in_module' in refs
|
||||||
|
assert 'mod.Cls' in refs
|
||||||
|
assert 'mod.Cls.meth1' in refs
|
||||||
|
assert 'mod.Cls.meth2' in refs
|
||||||
|
assert 'mod.Cls.meths' in refs
|
||||||
|
|
||||||
|
assert 'mod.Error' not in refs
|
||||||
|
assert 'errmod.Error' in refs
|
||||||
|
|
||||||
|
assert 'func_in_module' not in refs
|
||||||
|
assert 'func_noindex' not in refs
|
||||||
|
|
||||||
|
assert 'mod' in env.modules
|
||||||
|
assert env.modules['mod'] == ('desc', 'Module synopsis.', 'UNIX', False)
|
||||||
|
Loading…
Reference in New Issue
Block a user