Add minimal test for descitems.

This commit is contained in:
Georg Brandl 2008-10-18 17:57:35 +00:00
parent 3a1af61b9f
commit 9f4be9b916
6 changed files with 97 additions and 0 deletions

View File

@ -199,6 +199,11 @@ class TextTranslator(nodes.NodeVisitor):
def depart_desc_optional(self, node):
self.add_text(']')
def visit_desc_annotation(self, node):
pass
def depart_desc_annotation(self, node):
pass
def visit_refcount(self, node):
pass
def depart_refcount(self, node):

View File

@ -13,6 +13,7 @@ Contents:
images
includes
markup
desc
math
autodoc

60
tests/root/desc.txt Normal file
View 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.

View File

@ -103,6 +103,11 @@ Index markup
triple: index; entry; triple
Ö... Some strange characters
----------------------------
Testing öäü...
.. rubric:: Footnotes

View File

@ -58,6 +58,11 @@ HTML_XPATH = {
".//meta[@name='author'][@content='Me']": '',
".//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):

View File

@ -80,3 +80,24 @@ def test_second_update():
assert docnames == set(['contents', 'new'])
assert 'images' not in env.all_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)