summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJon Waltman <jonathan.waltman@gmail.com>2012-09-16 01:08:47 -0500
committerJon Waltman <jonathan.waltman@gmail.com>2012-09-16 01:08:47 -0500
commitbf3aa388d724bb36c0ce13cc13d15c475d80ddb0 (patch)
treee1e78977c44edfb3e4e8e1f1513f019cf68556a0 /tests
parent16fedf1ab62b2c1b18505f8317d348b13467ec1f (diff)
downloadsphinx-bf3aa388d724bb36c0ce13cc13d15c475d80ddb0.tar.gz
Closes #617: Fix docstring preparation without included signature: only ignore indentation of one line, not two.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_autodoc.py13
-rw-r--r--tests/test_only_directive.py2
2 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 965064c3..6dedaad8 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -519,6 +519,12 @@ def test_generate():
assert_result_contains(
' rest of docstring', 'method', 'test_autodoc.DocstringSig.meth')
assert_result_contains(
+ '.. py:method:: DocstringSig.meth2()', 'method',
+ 'test_autodoc.DocstringSig.meth2')
+ assert_result_contains(
+ ' indented line', 'method',
+ 'test_autodoc.DocstringSig.meth2')
+ assert_result_contains(
'.. py:classmethod:: Class.moore(a, e, f) -> happiness', 'method',
'test_autodoc.Class.moore')
@@ -660,6 +666,13 @@ First line of docstring
rest of docstring
"""
+ def meth2(self):
+ """First line, no signature
+ Second line followed by indentation::
+
+ indented line
+ """
+
class StrRepr(str):
def __repr__(self):
return self
diff --git a/tests/test_only_directive.py b/tests/test_only_directive.py
index 10683613..2396046e 100644
--- a/tests/test_only_directive.py
+++ b/tests/test_only_directive.py
@@ -39,7 +39,6 @@ def test_sectioning(app):
def testsects(prefix, sects, indent=0):
title = sects[0]
- sprint(' ' * indent + title)
parent_num = title.split()[0]
assert prefix == parent_num, \
'Section out of place: %r' % title
@@ -56,7 +55,6 @@ def test_sectioning(app):
parts = [getsects(n)
for n in filter(lambda n: isinstance(n, nodes.section),
doctree.children)]
- sprint('\nChecking headings in only.txt:')
for i, s in enumerate(parts):
testsects(str(i+1) + '.', s, 4)
assert len(parts) == 4, 'Expected 4 document level headings, got:\n%s' % \