summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2003-05-07 00:54:42 (GMT)
committerGreg Ward <gward@python.net>2003-05-07 00:54:42 (GMT)
commit49128575e801bfc1726e2bf4a022cd2e15224ecc (patch)
treef413357e8489634fafd5b075a57c7a5b659e0096 /Lib
parentc8d2290c8c5111b2b735482fab6cd2c47a6a8977 (diff)
downloadcpython-49128575e801bfc1726e2bf4a022cd2e15224ecc.zip
cpython-49128575e801bfc1726e2bf4a022cd2e15224ecc.tar.gz
cpython-49128575e801bfc1726e2bf4a022cd2e15224ecc.tar.bz2
SF #726446: ensure wrap() raises ValueError when width <= 0.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_textwrap.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index b8964dc..0f7f567 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):