From 3a19adb976393dc4066def880d0db11e2f7378d7 Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Sun, 15 Dec 2013 14:16:53 +0900 Subject: Drop python-2.5 and remove 2.4,2.5 support codes --- tests/test_autodoc.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'tests/test_autodoc.py') diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 63c341f1..7e60c5fb 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -737,12 +737,8 @@ def _funky_classmethod(name, b, c, d, docstring=None): some arguments.""" def template(cls, a, b, c, d=4, e=5, f=6): return a, b, c, d, e, f - if sys.version_info >= (2, 5): - from functools import partial - function = partial(template, b=b, c=c, d=d) - else: - def function(cls, a, e=5, f=6): - return template(a, b, c, d, e, f) + from functools import partial + function = partial(template, b=b, c=c, d=d) function.__name__ = name function.__doc__ = docstring return classmethod(function) @@ -774,10 +770,9 @@ class Class(Base): #: should be documented -- süß attr = 'bar' + @property def prop(self): """Property.""" - # stay 2.4 compatible (docstring!) - prop = property(prop, doc="Property.") docattr = 'baz' """should likewise be documented -- süß""" -- cgit v1.2.1 From fb6c6f5bfe4379c6e680a9757c84b7eebc8443d3 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Mon, 20 Jan 2014 11:54:51 -0500 Subject: Fix an exception introduced by b69b59480cba for __init__ with no docstring. --- tests/test_autodoc.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/test_autodoc.py') diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 82eb0f71..3d30d0dd 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -348,6 +348,22 @@ def test_get_doc(): directive.env.config.autoclass_content = 'both' assert getdocl('class', F) == ['Class docstring'] + # class has __init__ method with no docstring + class G(object): + """Class docstring""" + def __init__(self): + pass + + # docstring in the __init__ method of base class will not be used + for f in (False, True): + directive.env.config.autodoc_docstring_signature = f + directive.env.config.autoclass_content = 'class' + assert getdocl('class', G) == ['Class docstring'] + directive.env.config.autoclass_content = 'init' + assert getdocl('class', G) == ['Class docstring'] + directive.env.config.autoclass_content = 'both' + assert getdocl('class', G) == ['Class docstring'] + @with_setup(setup_test) def test_docstring_processing(): -- cgit v1.2.1