summaryrefslogtreecommitdiff
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-06-07 15:59:10 +0000
committerGeorg Brandl <georg@python.org>2008-06-07 15:59:10 +0000
commit7be19aabe20a04d8038383bc96c3dd96f27892c0 (patch)
tree535f4ab7bff1301239a2c5f3f2d7492c0ab5634b /Lib/test/test_inspect.py
parent6a5a177cba3aa36e53438901a1a52149b9010e92 (diff)
downloadcpython-git-7be19aabe20a04d8038383bc96c3dd96f27892c0.tar.gz
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index ef84f44f6c..32eeb57d31 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -185,6 +185,10 @@ class TestRetrievingSourceCode(GetSourceBase):
self.assertEqual(inspect.getdoc(git.abuse),
'Another\n\ndocstring\n\ncontaining\n\ntabs')
+ def test_cleandoc(self):
+ self.assertEqual(inspect.cleandoc('An\n indented\n docstring.'),
+ 'An\nindented\ndocstring.')
+
def test_getcomments(self):
self.assertEqual(inspect.getcomments(mod), '# line 1\n')
self.assertEqual(inspect.getcomments(mod.StupidGit), '# line 20\n')