From: Greg Ward Date: Wed, 7 May 2003 00:54:42 +0000 (+0000) Subject: SF #726446: ensure wrap() raises ValueError when width <= 0. X-Git-Tag: v2.3c1~825 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49128575e801bfc1726e2bf4a022cd2e15224ecc;p=python SF #726446: ensure wrap() raises ValueError when width <= 0. --- diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py index b8964dc23f..0f7f567bd3 100644 --- a/Lib/test/test_textwrap.py +++ b/Lib/test/test_textwrap.py @@ -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):