summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-10-28 19:45:01 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-10-28 19:45:01 (GMT)
commit2e0e18ba57ba4d8eb438734e2dc57bce0071f471 (patch)
treefcec0d39c478aca44b570ca4070f7332e6ed07ef /Lib/test
parent549edcfa054cc40d212a9c171f5ec7d353f43260 (diff)
parentf8152c67f52874cd4aa63f1cb3e1216382f98057 (diff)
downloadcpython-2e0e18ba57ba4d8eb438734e2dc57bce0071f471.zip
cpython-2e0e18ba57ba4d8eb438734e2dc57bce0071f471.tar.gz
cpython-2e0e18ba57ba4d8eb438734e2dc57bce0071f471.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_textwrap.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index 707aaaa..a44184f 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -748,6 +748,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):