mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-08-08 20:18:14 -05:00
* Fix: autosummary can't handle nested classes correctly. Closes #1441
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
C.class_attr
|
||||
C.prop_attr1
|
||||
C.prop_attr2
|
||||
C.C2
|
||||
"""
|
||||
|
||||
def withSentence():
|
||||
@@ -63,3 +64,8 @@ class C:
|
||||
|
||||
value is string.
|
||||
"""
|
||||
|
||||
class C2:
|
||||
'''
|
||||
This is a nested inner class docstring
|
||||
'''
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
"""
|
||||
import sys
|
||||
from functools import wraps
|
||||
from StringIO import StringIO
|
||||
|
||||
from sphinx.ext.autosummary import mangle_signature
|
||||
|
||||
from util import test_roots, TestApp
|
||||
|
||||
html_warnfile = StringIO()
|
||||
|
||||
|
||||
def with_autosummary_app(*args, **kw):
|
||||
default_kw = {
|
||||
@@ -75,7 +78,7 @@ def test_mangle_signature():
|
||||
assert res == outp, (u"'%s' -> '%s' != '%s'" % (inp, res, outp))
|
||||
|
||||
|
||||
@with_autosummary_app(buildername='html')
|
||||
@with_autosummary_app(buildername='html', warning=html_warnfile)
|
||||
def test_get_items_summary(app):
|
||||
app.builddir.rmtree(True)
|
||||
|
||||
@@ -98,6 +101,9 @@ def test_get_items_summary(app):
|
||||
finally:
|
||||
sphinx.ext.autosummary.Autosummary.get_items = orig_get_items
|
||||
|
||||
html_warnings = html_warnfile.getvalue()
|
||||
assert html_warnings == ''
|
||||
|
||||
expected_values = {
|
||||
'withSentence': 'I have a sentence which spans multiple lines.',
|
||||
'noSentence': "this doesn't start with a",
|
||||
@@ -106,6 +112,7 @@ def test_get_items_summary(app):
|
||||
'C.class_attr': 'This is a class attribute',
|
||||
'C.prop_attr1': 'This is a function docstring',
|
||||
'C.prop_attr2': 'This is a attribute docstring',
|
||||
'C.C2': 'This is a nested inner class docstring',
|
||||
}
|
||||
for key, expected in expected_values.iteritems():
|
||||
assert autosummary_items[key][2] == expected, 'Summary for %s was %r -'\
|
||||
|
||||
Reference in New Issue
Block a user