From ea4cb63e68d96697ff8eb9ea86da6158f27b95a2 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 28 Oct 2015 21:39:36 +0200 Subject: 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. --- Lib/test/test_textwrap.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Lib/test/test_textwrap.py') diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py index 1bba77eb9e..ea7c0895c1 100644 --- 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 margin is smaller than smallest indent + text = " \thello there\n \thow are you?\n \tI'm fine, thanks" + expect = " \thello there\n \thow are you?\n\tI'm fine, thanks" + self.assertEqual(expect, dedent(text)) + # Test textwrap.indent class IndentTestCase(unittest.TestCase): -- cgit v1.2.1