[Python-checkins] r66967 - in doctools/trunk: sphinx/textwriter.py tests/root/contents.txt tests/root/desc.txt tests/root/markup.txt tests/test_build.py tests/test_env.py
georg.brandl
python-checkins at python.org
Sat Oct 18 19:57:36 CEST 2008
Author: georg.brandl
Date: Sat Oct 18 19:57:35 2008
New Revision: 66967
Log:
Add minimal test for descitems.
Added:
doctools/trunk/tests/root/desc.txt (contents, props changed)
Modified:
doctools/trunk/sphinx/textwriter.py
doctools/trunk/tests/root/contents.txt
doctools/trunk/tests/root/markup.txt
doctools/trunk/tests/test_build.py
doctools/trunk/tests/test_env.py
Modified: doctools/trunk/sphinx/textwriter.py
==============================================================================
--- doctools/trunk/sphinx/textwriter.py (original)
+++ doctools/trunk/sphinx/textwriter.py Sat Oct 18 19:57:35 2008
@@ -199,6 +199,11 @@
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):
Modified: doctools/trunk/tests/root/contents.txt
==============================================================================
--- doctools/trunk/tests/root/contents.txt (original)
+++ doctools/trunk/tests/root/contents.txt Sat Oct 18 19:57:35 2008
@@ -13,6 +13,7 @@
images
includes
markup
+ desc
math
autodoc
Added: doctools/trunk/tests/root/desc.txt
==============================================================================
--- (empty file)
+++ doctools/trunk/tests/root/desc.txt Sat Oct 18 19:57:35 2008
@@ -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.
Modified: doctools/trunk/tests/root/markup.txt
==============================================================================
--- doctools/trunk/tests/root/markup.txt (original)
+++ doctools/trunk/tests/root/markup.txt Sat Oct 18 19:57:35 2008
@@ -103,6 +103,11 @@
triple: index; entry; triple
+Ö... Some strange characters
+----------------------------
+
+Testing öäü...
+
.. rubric:: Footnotes
Modified: doctools/trunk/tests/test_build.py
==============================================================================
--- doctools/trunk/tests/test_build.py (original)
+++ doctools/trunk/tests/test_build.py Sat Oct 18 19:57:35 2008
@@ -58,6 +58,11 @@
".//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):
Modified: doctools/trunk/tests/test_env.py
==============================================================================
--- doctools/trunk/tests/test_env.py (original)
+++ doctools/trunk/tests/test_env.py Sat Oct 18 19:57:35 2008
@@ -80,3 +80,24 @@
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)
More information about the Python-checkins
mailing list