Fix autodoc crash if :members: and :special-members: ware both set (by d7ac5e4).

This commit is contained in:
Takayuki Shimizukawa
2013-02-03 22:27:20 +09:00
parent e70a43a9c5
commit 70f3f889d1
2 changed files with 19 additions and 0 deletions

View File

@@ -90,6 +90,8 @@ def process_signature(app, what, name, obj, options, args, retann):
def skip_member(app, what, name, obj, skip, options):
if name in ('__special1__', '__special2__'):
return skip
if name.startswith('_'):
return True
if name == 'skipmeth':
@@ -519,6 +521,15 @@ def test_generate():
should.append(('method', 'test_autodoc.Class.inheritedmeth'))
assert_processes(should, 'class', 'Class')
# test special members
options.special_members = ['__special1__']
should.append(('method', 'test_autodoc.Class.__special1__'))
assert_processes(should, 'class', 'Class')
options.special_members = ALL
should.append(('method', 'test_autodoc.Class.__special2__'))
assert_processes(should, 'class', 'Class')
options.special_members = False
options.members = []
# test module flags
assert_result_contains('.. py:module:: test_autodoc',
@@ -750,6 +761,13 @@ class Class(Base):
self.inst_attr_string = None
"""a documented instance attribute"""
def __special1__(self):
"""documented special method"""
def __special2__(self):
# undocumented special method
pass
class CustomDict(dict):
"""Docstring."""