]> granicus.if.org Git - python/commitdiff
bpo-30603: Add test case to textwrap.dedent (GH-2014)
authorJonathan Eunice <jonathan.eunice@gmail.com>
Tue, 13 Jun 2017 19:04:10 +0000 (15:04 -0400)
committerMariatta <Mariatta@users.noreply.github.com>
Tue, 13 Jun 2017 19:04:10 +0000 (12:04 -0700)
Lib/test/test_textwrap.py

index 47d97bda86fd1fabf3202b9ee202ef1895b12e93..fe15348aff114bd2ae839cda1cedc217967e435b 100644 (file)
@@ -754,6 +754,11 @@ def foo():
         expect = "Foo\n  Bar\n\n Baz\n"
         self.assertEqual(expect, dedent(text))
 
+        # Uneven indentation with declining indent level.
+        text = "     Foo\n    Bar\n"  # 5 spaces, then 4
+        expect = " Foo\nBar\n"
+        self.assertEqual(expect, dedent(text))
+
     # dedent() should not mangle internal tabs
     def test_dedent_preserve_internal_tabs(self):
         text = "  hello\tthere\n  how are\tyou?"