cpython: faeeb8dbe432 (original) (raw)

Mercurial > cpython

changeset 98876:faeeb8dbe432 3.4

Issue #21827: Fixed textwrap.dedent() for the case when largest common whitespace is a substring of smallest leading whitespace. Based on patch by Robert Li. [#21827]

Serhiy Storchaka storchaka@gmail.com
date Wed, 28 Oct 2015 21:39:36 +0200
parents 8b1418e5dcc8
children 3f29be82c944 114fb81a08e3
files Lib/test/test_textwrap.py Lib/textwrap.py Misc/ACKS Misc/NEWS
diffstat 4 files changed, 18 insertions(+), 4 deletions(-)[+] [-] Lib/test/test_textwrap.py 5 Lib/textwrap.py 12 Misc/ACKS 1 Misc/NEWS 4

line wrap: on

line diff

--- a/Lib/test/test_textwrap.py +++ b/Lib/test/test_textwrap.py @@ -732,6 +732,11 @@ def foo(): expect = "hello there\n how are you?" self.assertEqual(expect, dedent(text))

+

Test textwrap.indent

class IndentTestCase(unittest.TestCase):

--- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -429,11 +429,15 @@ def dedent(text): elif margin.startswith(indent): margin = indent

# sanity check (testing/debugging only) if 0 and margin:

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -823,6 +823,7 @@ Mark Levitt Ivan Levkivskyi William Lewis Akira Li +Robert Li Xuanji Li Robert van Liere Ross Light

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -96,6 +96,10 @@ Core and Builtins Library ------- +- Issue #21827: Fixed textwrap.dedent() for the case when largest common