refactor: Add extract_summary() for easily testing

This commit is contained in:
Takeshi KOMIYA
2018-02-18 01:51:57 +09:00
parent 9b0bf85c93
commit 20613edc03
2 changed files with 39 additions and 25 deletions

View File

@@ -9,14 +9,12 @@
:license: BSD, see LICENSE for details.
"""
import pytest
from six import iteritems, StringIO
from sphinx.ext.autosummary import mangle_signature, import_by_name
from sphinx.ext.autosummary import mangle_signature, import_by_name, extract_summary
from sphinx.testing.util import etree_parse
import pytest
html_warnfile = StringIO()
@@ -57,6 +55,14 @@ def test_mangle_signature():
assert res == outp, (u"'%s' -> '%s' != '%s'" % (inp, res, outp))
def test_extract_summary():
doc = ['',
'This is a first sentence. And second one.',
'',
'Second block is here']
assert extract_summary(doc) == 'This is a first sentence.'
@pytest.mark.sphinx('dummy', **default_kw)
def test_get_items_summary(make_app, app_params):
import sphinx.ext.autosummary