diff options
| author | Georg Brandl <georg@python.org> | 2009-10-26 14:05:45 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2009-10-26 14:05:45 +0100 |
| commit | 3594104d4e114dc273a2d6115623ad108f19be68 (patch) | |
| tree | f77e3cd120290f88ff653de555512588accd6b50 /tests/test_autodoc.py | |
| parent | 68fd36580a27c3dcdb6379289edde990aedd7e4d (diff) | |
| parent | 13478a49867d358ef2c519cd5079ecd319d82628 (diff) | |
| download | sphinx-git-3594104d4e114dc273a2d6115623ad108f19be68.tar.gz | |
merge with trunk
Diffstat (limited to 'tests/test_autodoc.py')
| -rw-r--r-- | tests/test_autodoc.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index c1f783145..9f1e2bd9a 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -379,6 +379,7 @@ def test_generate(): options.exclude_members = set(['excludemeth']) assert_processes(should, 'class', 'Class') should.extend([('attribute', 'test_autodoc.Class.prop'), + ('attribute', 'test_autodoc.Class.descr'), ('attribute', 'test_autodoc.Class.attr'), ('attribute', 'test_autodoc.Class.docattr'), ('attribute', 'test_autodoc.Class.udocattr')]) @@ -428,6 +429,10 @@ def test_generate(): ('method', 'test_autodoc.Outer.Inner.meth')], 'class', 'Outer', all_members=True) + # test descriptor docstrings + assert_result_contains(' Descriptor instance docstring.', + 'attribute', 'test_autodoc.Class.descr') + # test generation for C modules (which have no source file) directive.env.doc_read_data['py_module'] = 'time' assert_processes([('function', 'time.asctime')], 'function', 'asctime') @@ -446,6 +451,17 @@ class CustomEx(Exception): def f(self): """Exception method.""" +class CustomDataDescriptor(object): + """Descriptor class docstring.""" + + def __init__(self, doc): + self.__doc__ = doc + + def __get__(self, obj, type=None): + if obj is None: + return self + return 42 + class Base(object): def inheritedmeth(self): """Inherited function.""" @@ -453,6 +469,8 @@ class Base(object): class Class(Base): """Class to document.""" + descr = CustomDataDescriptor("Descriptor instance docstring.") + def meth(self): """Function.""" |
