summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_textwrap.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-08-22 18:45:02 (GMT)
committerGreg Ward <gward@python.net>2002-08-22 18:45:02 (GMT)
commit9ebba9ace31ce0027d8f487a853bda7c2e1661cc (patch)
tree05b5db284a788088c764823285384bf720b82f89 /Lib/test/test_textwrap.py
parent3dc94e14c0a355f921a330ef32d93e2d30d17d25 (diff)
downloadcpython-9ebba9ace31ce0027d8f487a853bda7c2e1661cc.zip
cpython-9ebba9ace31ce0027d8f487a853bda7c2e1661cc.tar.gz
cpython-9ebba9ace31ce0027d8f487a853bda7c2e1661cc.tar.bz2
Simplify and reformat the use of 'subcases' lists (and following
for-loops) in test_simple(), test_wrap_short() test_hyphenated(), and test_funky_punc().
Diffstat (limited to 'Lib/test/test_textwrap.py')
-rw-r--r--Lib/test/test_textwrap.py84
1 files changed, 32 insertions, 52 deletions
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index f36213c..cb63387 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -45,25 +45,19 @@ class WrapTestCase(WrapperTestCase):
t = "Hello there, how are you this fine day? I'm glad to hear it!"
subcases = [
- ( (t, 12), [
- "Hello there,",
- "how are you",
- "this fine",
- "day? I'm",
- "glad to hear",
- "it!"
- ] ),
- ( (t, 42), [
- "Hello there, how are you this fine day?",
- "I'm glad to hear it!"
- ] ),
- ( (t, 80), [
- t
- ] ),
+ (12, ["Hello there,",
+ "how are you",
+ "this fine",
+ "day? I'm",
+ "glad to hear",
+ "it!"]),
+ (42, ["Hello there, how are you this fine day?",
+ "I'm glad to hear it!"]),
+ (80, [t]),
]
- for test, expect in subcases:
- result = wrap(*test)
+ for width, expect in subcases:
+ result = wrap(t, width)
self.check(result, expect)
@@ -99,17 +93,13 @@ What a mess!
t = "This is a\nshort paragraph."
subcases = [
- ( (t, 20), [
- "This is a short",
- "paragraph."
- ] ),
- ( (t, 40), [
- "This is a short paragraph."
- ] ),
+ (20, ["This is a short",
+ "paragraph."]),
+ (40, ["This is a short paragraph."]),
]
- for test, expect in subcases:
- result = wrap(*test)
+ for width, expect in subcases:
+ result = wrap(t, width)
self.check(result, expect)
@@ -119,22 +109,16 @@ What a mess!
t = "this-is-a-useful-feature-for-reformatting-posts-from-tim-peters'ly"
subcases = [
- ( (t, 40), [
- "this-is-a-useful-feature-for-",
- "reformatting-posts-from-tim-peters'ly"
- ] ),
- ( (t, 41), [
- "this-is-a-useful-feature-for-",
- "reformatting-posts-from-tim-peters'ly"
- ] ),
- ( (t, 42), [
- "this-is-a-useful-feature-for-reformatting-",
- "posts-from-tim-peters'ly"
- ] ),
+ (40, ["this-is-a-useful-feature-for-",
+ "reformatting-posts-from-tim-peters'ly"]),
+ (41, ["this-is-a-useful-feature-for-",
+ "reformatting-posts-from-tim-peters'ly"]),
+ (42, ["this-is-a-useful-feature-for-reformatting-",
+ "posts-from-tim-peters'ly"]),
]
- for test, expect in subcases:
- result = wrap(*test)
+ for width, expect in subcases:
+ result = wrap(t, width)
self.check(result, expect)
@@ -158,20 +142,16 @@ Did you say "supercalifragilisticexpialidocious?"
How *do* you spell that odd word, anyways?
'''
subcases = [
- ( (t, 30), [
- 'Did you say "supercalifragilis',
- 'ticexpialidocious?" How *do*',
- 'you spell that odd word,',
- 'anyways?'
- ] ),
- ( (t, 50), [
- 'Did you say "supercalifragilisticexpialidocious?"',
- 'How *do* you spell that odd word, anyways?'
- ] ),
+ (30, ['Did you say "supercalifragilis',
+ 'ticexpialidocious?" How *do*',
+ 'you spell that odd word,',
+ 'anyways?']),
+ (50, ['Did you say "supercalifragilisticexpialidocious?"',
+ 'How *do* you spell that odd word, anyways?']),
]
- for test, expect in subcases:
- result = wrap(*test)
+ for width, expect in subcases:
+ result = wrap(t, width)
self.check(result, expect)