summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-12-09 16:32:41 (GMT)
committerGreg Ward <gward@python.net>2002-12-09 16:32:41 (GMT)
commitc7e3c5e3062295d4c3a7d8a41e4c2246e7476194 (patch)
tree76dcb4d48bc1225cde85f04a48d3d448529eefc5 /Lib
parent24cbbcb57fddc3e0edcd7e9bdb02f368f0913dc0 (diff)
downloadcpython-c7e3c5e3062295d4c3a7d8a41e4c2246e7476194.zip
cpython-c7e3c5e3062295d4c3a7d8a41e4c2246e7476194.tar.gz
cpython-c7e3c5e3062295d4c3a7d8a41e4c2246e7476194.tar.bz2
Add test_unicode() to ensure that 1) textwrap doesn't crash on unicode
input, and 2) unicode input means unicode output. This closes SF bug #622831.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_textwrap.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index d164d75..b1cee30 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -239,6 +239,18 @@ What a mess!
self.check_wrap(text, 30,
[" This is a sentence with", "leading whitespace."])
+ def test_unicode(self):
+ # *Very* simple test of wrapping Unicode strings. I'm sure
+ # there's more to it than this, but let's at least make
+ # sure textwrap doesn't crash on Unicode input!
+ text = u"Hello there, how are you today?"
+ self.check_wrap(text, 50, [u"Hello there, how are you today?"])
+ self.check_wrap(text, 20, [u"Hello there, how are", "you today?"])
+ olines = self.wrapper.wrap(text)
+ assert isinstance(olines, list) and isinstance(olines[0], unicode)
+ otext = self.wrapper.fill(text)
+ assert isinstance(otext, unicode)
+
def test_split(self):
# Ensure that the standard _split() method works as advertised
# in the comments