summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-01-06 13:03:17 +0100
committerGeorg Brandl <georg@python.org>2011-01-06 13:03:17 +0100
commit86215260458069fdc9b64b58e111540e03f4ff6a (patch)
tree411a458708202d590eada215d2cefe483a3ca205 /tests/test_autodoc.py
parent400e1a7fa8e85acceab6dbde726a44a5e3a5578e (diff)
downloadsphinx-git-86215260458069fdc9b64b58e111540e03f4ff6a.tar.gz
#568: Fix lookup of class attribute documentation on descriptors so that comment documentation now works.
Needed to port assignment of ``self.parent`` from trunk.
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 0b1709721..a367fb938 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -17,6 +17,7 @@ from docutils.statemachine import ViewList
from sphinx.ext.autodoc import AutoDirective, add_documenter, \
ModuleLevelDocumenter, FunctionDocumenter, cut_lines, between, ALL
+from StringIO import StringIO
def setup_module():
global app, lid, options, directive
@@ -416,6 +417,7 @@ def test_generate():
('attribute', 'test_autodoc.Class.attr'),
('attribute', 'test_autodoc.Class.docattr'),
('attribute', 'test_autodoc.Class.udocattr'),
+ ('attribute', 'test_autodoc.Class.mdocattr'),
('attribute', 'test_autodoc.Class.inst_attr_comment'),
('attribute', 'test_autodoc.Class.inst_attr_string')
])
@@ -484,11 +486,19 @@ def test_generate():
' .. py:attribute:: Class.prop',
' .. py:attribute:: Class.docattr',
' .. py:attribute:: Class.udocattr',
+ ' .. py:attribute:: Class.mdocattr',
' .. py:attribute:: Class.inst_attr_comment',
' .. py:attribute:: Class.inst_attr_string',
' .. py:method:: Class.inheritedmeth()',
],
'class', 'Class', member_order='bysource', all_members=True)
+ del directive.env.temp_data['py:module']
+
+ # test attribute initialized to class instance from other module
+ directive.env.temp_data['autodoc:class'] = 'test_autodoc.Class'
+ assert_result_contains(u' should be documented as well - s\xfc\xdf',
+ 'attribute', 'mdocattr')
+ del directive.env.temp_data['autodoc:class']
# --- generate fodder ------------
@@ -552,6 +562,10 @@ class Class(Base):
udocattr = 'quux'
u"""should be documented as well - süß"""
+ # initialized to any class imported from another module
+ mdocattr = StringIO()
+ """should be documented as well - süß"""
+
def __init__(self, arg):
#: a documented instance attribute
self.inst_attr_comment = None