mò %U²Ic@sÎdkZdklZdklZlZlZlZdeifd„ƒYZ de fd„ƒYZ de fd„ƒYZ d e fd „ƒYZ d eifd „ƒYZ d „Zedjo eƒndS(N(s test_support(s TextWrapperswrapsfillsdedentt BaseTestCasecBs2tZdZd„Zd„Zd„Zd„ZRS(s5Parent class with utility methods for textwrap tests.cCs‰t|tƒoQg}x5tt|ƒƒD]!}|id|||fƒq)Wdi|ƒ}n%t|t ƒodt |ƒ}n|S(Ns %d: %rs s %s ( t isinstancettextintlisttresulttrangetlentitappendtjoint basestringtrepr(tselfRRR((t//data/zmath/lib/python2.4/test/test_textwrap.pytshowscCs3|i||d|i|ƒ|i|ƒfƒdS(Nsexpected: %s but got: %s(R t assertEqualsRtexpectR(R RR((R tchecks cKs&t|||}|i||ƒdS(N(twrapttexttwidthtkwargsRR RR(R RRRRR((R t check_wrap$scCs3|ii|ƒ}|i||d||fƒdS(Ns expected %r but got %r(R twrappert_splitRRRR(R RRR((R t check_split(s (t__name__t __module__t__doc__RRRR(((R Rs   t WrapTestCasecBs¡tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Zd„Zd„Zd„Zd„ZRS(NcCstddƒ|_dS(NRi-(t TextWrapperR R(R ((R tsetUp1sc Cs^d}|i|dddddddgƒ|i|d d d gƒ|i|d |gƒdS( Ns=Hello there, how are you this fine day? I'm glad to hear it!i s Hello there,s how are yous this fines day? I'ms glad to hearsit!i*s'Hello there, how are you this fine day?sI'm glad to hear it!iP(RR R(R R((R t test_simple4s    cCsxd}dddddg}tddtƒ}|i|ƒ}|i||ƒ|i |ƒ}|i|d i |ƒƒdS( Ns®This is a paragraph that already has line breaks. But some of its lines are much longer than the others, so it needs to be wrapped. Some lines are tabbed too. What a mess! s)This is a paragraph that already has lines'breaks. But some of its lines are muchs)longer than the others, so it needs to bes-wrapped. Some lines are tabbed too. What asmess!i-tfix_sentence_endingss ( RRRtTrueRRRR RtfillR (R RRRR((R ttest_whitespaceFscCs7tddtƒ}d}dg}|i|i|ƒ|ƒd}dg}|i|i|ƒ|ƒd}|i|i|ƒ|ƒd}d g}|i|i|ƒ|ƒd |_d d d g}|i|i|ƒ|ƒd}dddg}|i|i|ƒ|ƒd|_dg}|i|i|ƒ|ƒdS(Ni<R!s$A short line. Note the single space.s%A short line. Note the single space.s Well, Doctor? What do you think?s!Well, Doctor? What do you think?s Well, Doctor? What do you think?s)I say, chaps! Anyone for "tennis?" Hmmph!s+I say, chaps! Anyone for "tennis?" Hmmph!is I say, chaps!sAnyone for "tennis?"sHmmph!s1And she said, "Go to hell!" Can you believe that?sAnd she said, "Go toshell!" Can yous believe that?s2And she said, "Go to hell!" Can you believe that?( RR"RRRR RRR(R RRR((R ttest_fix_sentence_endings^s*      cCs9d}|i|dddgƒ|i|ddgƒdS(NsThis is a short paragraph.isThis is a shorts paragraph.i(sThis is a short paragraph.(RR R(R R((R ttest_wrap_short„scCs<d}|i|ddgƒ|i|ddgddƒdS(NsThis is a short line.is(1) This is a short line.tinitial_indents(1) (RR R(R R((R ttest_wrap_short_1lineŽscCsUd}|i|dddgƒ|i|dddgƒ|i|dddgƒdS( NsBthis-is-a-useful-feature-for-reformatting-posts-from-tim-peters'lyi(sthis-is-a-useful-feature-for-s%reformatting-posts-from-tim-peters'lyi)i*s*this-is-a-useful-feature-for-reformatting-sposts-from-tim-peters'ly(RR R(R R((R ttest_hyphenated˜s     cCsd}|i|ddddgƒ|i|dddgƒd }|i|d d d gƒ|i|d d d gƒ|i|dd gƒdS(NsRPython 1.0.0 was released on 1994-01-26. Python 1.0.1 was released on 1994-02-15.isPython 1.0.0 was released ons1994-01-26. Python 1.0.1 wassreleased on 1994-02-15.i(s(Python 1.0.0 was released on 1994-01-26.s(Python 1.0.1 was released on 1994-02-15.sI do all my shopping at 7-11.isI do all my shopping ats7-11.ii(RR R(R R((R ttest_hyphenated_numbers¨scCsçd}|i|dddgƒ|i|dddgƒdd g}|i|d |ƒ|i|d |ƒ|i|d dgƒd }dddg}|i|d|ƒ|i|d|ƒdddg}|i|d|ƒ|i|d|ƒddg}|i|d|ƒ|i|d|ƒddg}|i|d|ƒ|i|d |ƒd}ddddd dd!d"dd#d d$dd%d&d#dd'g}|i||ƒd(}d#dd)d d*d d+dd,dd-g }|i||ƒdS(.Ns$Em-dashes should be written -- thus.isEm-dashes should beswritten -- thus.isEm-dashes should be writtens-- thus.sEm-dashes should be written --sthus.ii#i$s%You can also do--this or even---this.sYou can also dos--this or evens---this.iisYou can also do--sthis or even---sthis.iisYou can also do--this or evenis You can also do--this or even---i s7Here's an -- em-dash and--here's another---and another!sHere'st tans--sem-tdashtandshere'stanothers---sanother!sand then--bam!--he was gonetthensbam!thetwastgone(RR RRR(R RR((R t test_em_dashºs:         <'cCs4d}|i|dddddgƒ|i|ddd d gƒd d g}|i|d |ƒ|i|d|ƒ|i|d|ƒ|i|d|ƒddg}|i|d|ƒ|i|d|ƒdd g}|i|d|ƒd}ddddddddddddddg}|i||ƒdS( Ns<You should use the -n option, or --dry-run in its long form.isYou should use thes-n option, or --dry-srun in its longsform.isYou should use the -nsoption, or --dry-runsin its long form.s You should use the -n option, ors--dry-run in its long form.i i"i#i&s'You should use the -n option, or --dry-srun in its long form.i'i)s*You should use the -n option, or --dry-runi*s'the -n option, or --dry-run or --dryrunttheR+s-nsoption,tors--dry-truns--dryrun(RR RRR(R RR((R ttest_unix_optionsñs$     0cCs³|iddddddgƒ|iddddgƒ|id ddd gƒ|id d gƒ|id d gƒ|id ddgƒ|idddddddgƒdS(Nswhat the--hey!twhatR+R5s--shey!s what the--sthe--s what the--.sthe--.s --text--.s--options --option-opts --option-toptsfoo --option-opt bartfootbar(R R(R ((R ttest_funky_hyphenss cCsŒ|idddddddgƒ|iddddd ddgƒ|id ddd d ddgƒ|id ddddddgƒdS(Nsthe 'wibble-wobble' widgetR5R+s'wibble-swobble'twidgetsthe "wibble-wobble" widgets"wibble-swobble"sthe (wibble-wobble) widgets(wibble-swobble)sthe ['wibble-wobble'] widgets ['wibble-swobble'](R R(R ((R ttest_punct_hyphens$s    c Csg|iddddddgƒ|iddddddgƒ|id d dd dd dd gƒdS(Nsfoo (--option) barR;R+s (--option)R<s foo (bar) bazs(bar)tbazsblah (ding dong), wubbatblahs(dingsdong),twubba(R R(R ((R ttest_funky_parens5s    cCs9d}|i|ddgƒ|i|dddgƒdS(Ns, This is a sentence with leading whitespace.i2is This is a sentence withsleading whitespace.(RR R(R R((R ttest_initial_whitespaceBs    cCs]d}|i|ddgƒ|i|dddgƒ|ii|ƒ}|ii|ƒ}dS(NuHello there, how are you today?i2iuHello there, how ares you today?(RR RRRtolinesR#totext(R RRERF((R t test_unicodeKs cCsbd}|ii|ƒ}|i|dddddddddddd dd dd dd gƒdS( Ns0Hello there -- you goof-ball, use the -b option!tHelloR+ttheres--tyousgoof-sball,tuseR5s-bsoption!(RR RRRR(R RR((R t test_splitWs cCs6d}|itt|dƒ|itt|dƒdS(NsWhatever, it doesn't matter.iiÿÿÿÿ(RR t assertRaisest ValueErrorR(R R((R ttest_bad_widthbs(RRRR R$R%R&R(R)R*R4R8R=R?RCRDRGRLRO(((R R/s"    &   7 "   tLongWordTestCasecBs#tZd„Zd„Zd„ZRS(NcCstƒ|_d|_dS(Ns]Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? (RR RR(R ((R Rjs c Csy|i|idddddgƒ|i|idddgƒ|id d d d d d ddddgdddƒdS(NisDid you say "supercalifragilissticexpialidocious?" How *do*syou spell that odd word,sanyways?i2s1Did you say "supercalifragilisticexpialidocious?"s*How *do* you spell that odd word, anyways?t-i thellos ----------s hs es ls otsubsequent_indentR+i(R RR(R ((R ttest_break_longqs cCs~d|i_d|i_ddddg}|ii|iƒ}|i||ƒt|iddddƒ}|i||ƒdS( Niis Did you says%"supercalifragilisticexpialidocious?"sHow *do* you spell that oddsword, anyways?Rtbreak_long_words( R RRURRRRRR(R RR((R ttest_nobreak_longˆs  (RRRRTRV(((R RPis  tIndentTestCasescBs,tZd„Zd„Zd„Zd„ZRS(NcCs d|_dS(NsnThis paragraph will be filled, first without any indentation, and then with some (including a hanging indent).(R R(R ((R RœscCs,d}t|idƒ}|i||ƒdS(NsnThis paragraph will be filled, first without any indentation, and then with some (including a hanging indent).i((RR#R RRR(R RR((R t test_fill¢scCsrdddg}t|idddƒ}|i||ƒdi|ƒ}t|idddƒ}|i||ƒdS(Ns# This paragraph will be filled,s'first without any indentation, and thens'with some (including a hanging indent).i(R's s (RRR RRRR R#(R RR((R ttest_initial_indent®s cCs8d}t|idddddƒ}|i||ƒdS(Ns~ * This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).i(R's * RSs (RR#R RRR(R RR((R ttest_subsequent_indent¼s (RRRRXRYRZ(((R RW™s  tDedentTestCasecBs#tZd„Zd„Zd„ZRS(NcCstd}|it|ƒ|ƒd}|it|ƒ|ƒd}|it|ƒ|ƒd}|it|ƒ|ƒdS(Ns,Hello there. How are you? Oh good, I'm glad.sHello there. Boo!s Hello there. This is indented.sHello there. Boo! (RR Rtdedent(R R((R ttest_dedent_nomarginÎscCsjd}d}|it|ƒ|ƒd}d}|it|ƒ|ƒd}d}|it|ƒ|ƒdS(Ns' Hello there. How are ya? Oh good.s!Hello there. How are ya? Oh good.s) Hello there. How are ya? Oh good. s#Hello there. How are ya? Oh good. s+ Hello there. How are ya? Oh good. (RRR RR\(R RR((R ttest_dedent_evenßscCsjd}d}|it|ƒ|ƒd}d}|it|ƒ|ƒd}d}|it|ƒ|ƒdS(NsK def foo(): while 1: return foo s+def foo(): while 1: return foo s Foo Bar Baz sFoo Bar Baz s Foo Bar Baz (RRR RR\(R RR((R ttest_dedent_unevenïs(RRR]R^R_(((R R[Ìs  cCstittttƒdS(N(t test_supportt run_unittestRRPRWR[(((R t test_main s t__main__(tunittestttestR`ttextwrapRRR#R\tTestCaseRRRPRWR[RbR( R`R\RRRdRRPR[RbRRWR#((R t? s  ÿ;03=