Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index ef84f44..32eeb57 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -185,6 +185,10 @@
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')