]> granicus.if.org Git - python/commitdiff
SF #726446: ensure wrap() raises ValueError when width <= 0.
authorGreg Ward <gward@python.net>
Wed, 7 May 2003 00:54:42 +0000 (00:54 +0000)
committerGreg Ward <gward@python.net>
Wed, 7 May 2003 00:54:42 +0000 (00:54 +0000)
Lib/test/test_textwrap.py

index b8964dc23f7626c969131c8e19d40d4e5039af2f..0f7f567bd3c75e71875d283fd0e53a69c8d1d584 100644 (file)
@@ -262,6 +262,12 @@ What a mess!
              ["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-",
               "ball,", " ", "use", " ", "the", " ", "-b", " ",  "option!"])
 
+    def test_bad_width(self):
+        # Ensure that width <= 0 is caught.
+        text = "Whatever, it doesn't matter."
+        self.assertRaises(ValueError, wrap, text, 0)
+        self.assertRaises(ValueError, wrap, text, -1)
+
 
 class LongWordTestCase (BaseTestCase):
     def setUp(self):