
    0hh                     ^   S SK r S SKJrJrJrJrJrJr   " S S\ R                  5      r	 " S S\	5      r
 " S S\	5      r " S	 S
\	5      r " S S\	5      r " S S\	5      r " S S\ R                  5      r " S S\ R                  5      r " S S\	5      r\S:X  a  \ R&                  " 5         gg)    N)TextWrapperwrapfilldedentindentshortenc                   ,    \ rS rSrS rS rS rS rSrg)BaseTestCase   c                    [        U[        5      (       aS  / n[        [        U5      5       H  nUR	                  SX1U   4-  5        M     U(       a  SR                  U5      nU$ SnU$ [        U[        5      (       a  S[        U5      -  nW$ )Nz  %d: %r
z
  no linesz  %s
)
isinstancelistrangelenappendjoinstrrepr)selftextinresultis       ;/opt/python-3.13.8/usr/lib/python3.13/test/test_textwrap.pyshowBaseTestCase.show   s    fd##F3v;'jAay>9: (*0TYYv&F  7CF  $$V,F    c           
      t    U R                  XSU R                  U5      < SU R                  U5      < 35        g )Nz
expected:
z

but got:
)assertEqualr   )r   r   expects      r   checkBaseTestCase.check   s0    		&!499V#46	7r   c                 >    [        X40 UD6nU R                  XS5        g N)r   r!   r   textwidthr    kwargsr   s         r   
check_wrapBaseTestCase.check_wrap#   s    d,V,

6"r   c                 n    U R                   R                  U5      nU R                  X2SU< SU< 35        g )Nz

expected z

but got  )wrapper_splitr   )r   r&   r    r   s       r   check_splitBaseTestCase.check_split'   s2    $$T**0&:	;r    N)	__name__
__module____qualname____firstlineno__r   r!   r)   r.   __static_attributes__r0   r   r   r
   r
      s    7
#;r   r
   c                       \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S r"g!)"WrapTestCase.   c                      [        SS9U l        g )N-   )r'   )r   r,   r   s    r   setUpWrapTestCase.setUp0   s    ",r   c                     SnU R                  US/ SQ5        U R                  USSS/5        U R                  USU/5        g )N=Hello there, how are you this fine day?  I'm glad to hear it!   Hello there,how are you	this finez	day?  I'mzglad to hearzit!*   z'Hello there, how are you this fine day?zI'm glad to hear it!P   r)   r   r&   s     r   test_simpleWrapTestCase.test_simple3   sP     Ob 	! 	bB/1	2 	b4&)r   c                 N    U R                  SS/ 5        U R                  SS/ SS9  g )N    Fdrop_whitespacerG   r;   s    r   test_empty_stringWrapTestCase.test_empty_stringD   s&    Ar"Ar59r   c                 N    U R                  SS/ SS9  U R                  SS/ SSS9  g )NrL   rM   ++initial_indentF)rU   rO   rG   r;   s    r   %test_empty_string_with_initial_indent2WrapTestCase.test_empty_string_with_initial_indentI   s,    Ar$7Ar$Nr   c                 *   Sn/ SQn[        SSS9nUR                  U5      nU R                  XB5        UR                  U5      nU R                  USR	                  U5      5        SnS/nU R                  US	U5        S
nS/nU R                  US	USS9  g )NzThis 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!
)z)This is a paragraph that already has linez'breaks.  But some of its lines are muchz)longer than the others, so it needs to bez-wrapped.  Some lines are  tabbed too.  What azmess!r:   Tfix_sentence_endingsr   z	Test	default		tabsize.z(        Test    default         tabsize.rF   z	Test	custom		tabsize.z     Test    custom      tabsize.   )tabsize)r   r   r!   r   r   r)   )r   r&   r    r,   r   s        r   test_whitespaceWrapTestCase.test_whitespaceN   s     bt<d#

6"d#

6499V,-,<=b&)+45b&!4r   c                    [        SSS9nSnS/nU R                  UR                  U5      U5        SnS/nU R                  UR                  U5      U5        SnU R                  UR                  U5      U5        S	nS
/nU R                  UR                  U5      U5        SUl        / SQnU R                  UR                  U5      U5        Sn/ SQnU R                  UR                  U5      U5        SUl        S/nU R                  UR                  U5      U5        SnS/nU R                  UR                  U5      U5        g )N<   TrY   z$A short line. Note the single space.z%A short line.  Note the single space.z Well, Doctor? What do you think?z!Well, Doctor?  What do you think?z Well, Doctor?
What do you think?z)I say, chaps! Anyone for "tennis?"
Hmmph!z+I say, chaps!  Anyone for "tennis?"  Hmmph!   )zI say, chaps!zAnyone for "tennis?"zHmmph!z1And she said, "Go to hell!"
Can you believe that?)zAnd she said, "Go tozhell!"  Can youzbelieve that?z2And she said, "Go to hell!"  Can you believe that?zFile stdio.h is nice.)r   r!   r   r'   )r   r,   r&   r    s       r   test_fix_sentence_endings&WrapTestCase.test_fix_sentence_endingsn   s,   bt<
 69:

7<<%v.
 256

7<<%v.2

7<<%v.;?@

7<<%v.D

7<<%v.C# 	

7<<%v.FG

7<<%v.&)*

7<<%v.r   c                 Z    SnU R                  USSS/5        U R                  USS/5        g )NzThis is a
short paragraph.ra   zThis is a shortz
paragraph.(   zThis is a short paragraph.rG   rH   s     r   test_wrap_shortWrapTestCase.test_wrap_short   s8     -b#4#/#1 	2b#?"@Ar   c                 V    SnU R                  USS/5        U R                  USS/SS9  g )NzThis is a short line.   z(1) This is a short line.z(1) rT   rG   rH   s     r   test_wrap_short_1line"WrapTestCase.test_wrap_short_1line   s;     'b#:";<b#>"?'- 	 	/r   c                 |   SnU R                  USSS/5        U R                  USSS/5        U R                  USSS/5        S	R                  S
5      nU R                  USUSS9  U R                  X5        U R                  SS/5        U R                  SS/5        U R                  SSR                  S
5      5        g )NzBthis-is-a-useful-feature-for-reformatting-posts-from-tim-peters'lyre   zthis-is-a-useful-feature-for-z%reformatting-posts-from-tim-peters'ly)   rE   z*this-is-a-useful-feature-for-reformatting-zposts-from-tim-peters'lyzLthis-|is-|a-|useful-|feature-|for-|reformatting-|posts-|from-|tim-|peters'ly|   Fbreak_long_wordsze-mailzJelly-Ozhalf-a-crownzhalf-|a-|crown)r)   splitr.   r   r&   r    s      r   test_hyphenatedWrapTestCase.test_hyphenated   s    8 	b8@B	C 	b8@B	C 	bE35	6>?DuSz 	a%@&H:.YK0)9)?)?)DEr   c                 \   SnU R                  US/ SQ5        U R                  USSS/5        U R                  USUR                  5       SS	9  S
nU R                  USSS/5        U R                  USSS/5        U R                  USS
/5        U R                  USUR                  5       SS	9  g )NzRPython 1.0.0 was released on 1994-01-26.  Python 1.0.1 was
released on 1994-02-15.ri   )zPython 1.0.0 was released onz1994-01-26.  Python 1.0.1 waszreleased on 1994-02-15.re   z(Python 1.0.0 was released on 1994-01-26.z(Python 1.0.1 was released on 1994-02-15.ro   Frp   zI do all my shopping at 7-11.   zI do all my shopping atz7-11.      )r)   rr   rH   s     r   test_hyphenated_numbers$WrapTestCase.test_hyphenated_numbers   s    * 	b #> 	? 	b#M#M#O 	PaF.b#<#*#, 	-b#<#*#, 	-b#B"CDaFr   c                    SnU R                  USSS/5        U R                  USSS/5        SS	/nU R                  US
U5        U R                  USU5        U R                  USS/5        Sn/ SQnU R                  USU5        U R                  USU5        / SQnU R                  USU5        U R                  USU5        SS/nU R                  USU5        U R                  USU5        SS/nU R                  USU5        U R                  USU5        Sn/ SQnU R                  X5        Sn/ SQnU R                  X5        g )Nz$Em-dashes should be written -- thus.rw   zEm-dashes should bezwritten -- thus.ry   zEm-dashes should be writtenz-- thus.zEm-dashes should be written --zthus.ri   #   $   z%You can also do--this or even---this.)zYou can also doz--this or even---this.   r   )zYou can also do--zthis or even---this.      zYou can also do--this or evenr      z You can also do--this or even---r       z7Here's an -- em-dash and--here's another---and another!)zHere's anr   --r   zem-dashr   andr   zhere'sr   anotherz---r   r   zanother!zand then--bam!--he was gone)r   r   thenr   zbam!r   her   wasr   goner)   r.   rs   s      r   test_em_dashWrapTestCase.test_em_dash   sq   5b.+-	. 	b6#%	& 3b&)b&)b?@	B
 7 	b&)b&) 	b&)b&)1b&)b&)4b&)b&) I* 	&,1&r   c                    SnU R                  US/ SQ5        U R                  US/ SQ5        SS/nU R                  USU5        U R                  US	U5        U R                  US
U5        U R                  USU5        SS/nU R                  USU5        U R                  USU5        SS/nU R                  USU5        Sn/ SQnU R                  X5        g )Nz<You should use the -n option, or --dry-run in its long form.ra   )zYou should use thez-n option, or --dry-zrun in its longzform.   )zYou should use the -nzoption, or --dry-runin its long form.z You should use the -n option, orz--dry-run in its long form.r   "   r}   &   z'You should use the -n option, or --dry-zrun in its long form.'   rm   z*You should use the -n option, or --dry-runr   rE   z'the -n option, or --dry-run or --dryrun)ther   z-nr   zoption,r   orr   z--dry-runr   r   r   z--dryrunr   rs   s      r   test_unix_optionsWrapTestCase.test_unix_options  s     Nb"	#
 	b.	/ 5/1b&)b&)b&)b&);)+b&)b&)>%'b&) 9?&r   c                    U R                  S/ SQ5        U R                  S/ SQ5        U R                  S/ SQ5        U R                  SS/5        U R                  SS/5        U R                  S	S
S/5        U R                  S/ SQ5        g )Nzwhat the--hey!)whatr   r   r   zhey!z
what the--)r   r   zthe--zwhat the--.)r   r   zthe--.z	--text--.z--optionz--option-opt	--option-optzfoo --option-opt bar)foor   r   r   r   barr.   r;   s    r   test_funky_hyphensWrapTestCase.test_funky_hyphens3  s     	)+MN'=>(?@{m4 	j\2+u)=>/E	Gr   c                     U R                  S/ SQ5        U R                  S/ SQ5        U R                  S/ SQ5        U R                  S/ SQ5        U R                  S	S
R                  S5      5        g )Nzthe 'wibble-wobble' widget)r   r   z'wibble-zwobble'r   widgetzthe "wibble-wobble" widget)r   r   z"wibble-zwobble"r   r   zthe (wibble-wobble) widget)r   r   z(wibble-zwobble)r   r   zthe ['wibble-wobble'] widget)r   r   z	['wibble-zwobble']r   r   zwhat-d'you-call-it.zwhat-d'you-|call-|it.rn   )r.   rr   r;   s    r   test_punct_hyphensWrapTestCase.test_punct_hyphensD  sy     	5K	M5K	M5K	M7M	O 	.066s;	=r   c                 |    U R                  S/ SQ5        U R                  S/ SQ5        U R                  S/ SQ5        g )Nzfoo (--option) bar)r   r   z
(--option)r   r   zfoo (bar) baz)r   r   z(bar)r   bazzblah (ding dong), wubba)blahr   z(dingr   zdong),r   wubbar   r;   s    r   test_funky_parensWrapTestCase.test_funky_parensY  sD     	-?	A 	:	<2(	)r   c                 0    SnU R                  US/ SQSS9  g )Nz0 This is a    sentence with     much whitespace.
   )z
 This is a    z	sentence z	with     z
much whitezspace.FrN   rG   rH   s     r   test_drop_whitespace_false'WrapTestCase.test_drop_whitespace_falsef  s'     Bb>(- 	 	/r   c                 *    U R                  SSS/SS9  g )N   rM   FrN   rG   r;   s    r   *test_drop_whitespace_false_whitespace_only7WrapTestCase.test_drop_whitespace_false_whitespace_onlyo  s    q5'5Ar   c                 ,    U R                  SSS/SSS9  g )Nr   rM        F  )rO   rU   rG   r;   s    r   6test_drop_whitespace_false_whitespace_only_with_indentCWrapTestCase.test_drop_whitespace_false_whitespace_only_with_indents  s"     	q7)U'+ 	 	-r   c                 *    U R                  SS/ 5        g )Nr   rM   rG   r;   s    r   $test_drop_whitespace_whitespace_only1WrapTestCase.test_drop_whitespace_whitespace_onlyy  s    a$r   c                 Z    SnU R                  USS/5        U R                  USSS/5        g )Nz, This is a sentence with leading whitespace.2   ri   z This is a sentence withzleading whitespace.rG   rH   s     r   'test_drop_whitespace_leading_whitespace4WrapTestCase.test_drop_whitespace_leading_whitespace}  s:    
 >bGH	Jb35JK	Mr   c                 Z    SnU R                  US/ SQSS9  U R                  USSS/5        g )Nzabcd    efghrM   )abcdr   efghFrN   r   r   rG   rH   s     r   $test_drop_whitespace_whitespace_line1WrapTestCase.test_drop_whitespace_whitespace_line  s9     a!9(- 	 	/a&&!12r   c                 (    U R                  SS/ SS9  g )Nr   rM   rS   rT   rG   r;   s    r   0test_drop_whitespace_whitespace_only_with_indent=WrapTestCase.test_drop_whitespace_whitespace_only_with_indent  s     	aD9r   c                 .    U R                  SSSS/SSS9  g )Nz	abcd efghrM   z  abcdz  efghr   rU   subsequent_indentrG   r;   s    r   &test_drop_whitespace_whitespace_indent3WrapTestCase.test_drop_whitespace_whitespace_indent  s&     	Q8(<'+t 	 	Er   c                 f    SnU R                   R                  U5      nU R                  U/ SQ5        g )Nz0Hello there -- you goof-ball, use the -b option!)Hellor   therer   r   r   your   zgoof-zball,r   user   r   r   z-br   zoption!)r,   r-   r!   )r   r&   r   s      r   
test_splitWrapTestCase.test_split  s3     B$$T*

6K	Lr   c                 X    SnU R                  USSS/SS9  U R                  USSS/S	S9  g )
Nzyaba daba-door   z
yaba daba-dooTbreak_on_hyphensyabazdaba-dooFrG   rH   s     r   test_break_on_hyphens"WrapTestCase.test_break_on_hyphens  sE    b<"7)- 	 	/b6:"6). 	 	0r   c                 x    SnU R                  [        [        US5        U R                  [        [        US5        g )NzWhatever, it doesn't matter.r   )assertRaises
ValueErrorr   rH   s     r   test_bad_widthWrapTestCase.test_bad_width  s/    -*dD!4*dD"5r   c                 2    SnU R                  US/ SQ5        g )Nu   Die Empfänger-Auswahl   )Dieu   Empfänger-AuswahlrG   rH   s     r   test_no_split_at_umlaut$WrapTestCase.test_no_split_at_umlaut  s    )b"EFr   c                 2    SnU R                  USSS/5        g )Nu   aa ää-ää   u   aa ää-u   äärG   rH   s     r   test_umlaut_followed_by_dash)WrapTestCase.test_umlaut_followed_by_dash  s    %a.*!=>r   c                 X    SnU R                  US/ SQSS9  U R                  US/ SQSS9  g )Nu,   This is a sentence with non-breaking space.ra   )This is a sentence	with non-u   breaking space.Tr   )r   withu   non-breaking space.FrG   rH   s     r   test_non_breaking_space$WrapTestCase.test_non_breaking_space  sH    Mb= *.	 	 	/ 	bA */	 	 	0r   c                 X    SnU R                  US/ SQSS9  U R                  US/ SQSS9  g )Nu-   This is a sentence with non-breaking space.ra   )r   r   u   breaking space.Tr   )r   r   u   non-breaking space.FrG   rH   s     r   test_narrow_non_breaking_space+WrapTestCase.test_narrow_non_breaking_space  sM    2 	bD *.	 	 	/ 	bH */	 	 	0r   )r,   N)#r1   r2   r3   r4   r<   rI   rP   rV   r]   rb   rf   rj   rt   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r5   r0   r   r   r7   r7   .   s    -*":
O
5@(/TB/F4G(4'n 'DG"=*)/B-%	M3:E	L06G?00r   r7   c                   0    \ rS rSrSrS rS rS rS rSr	g)	MaxLinesTestCasei  r?   c                 z   U R                  U R                  SS/SS9  U R                  U R                  SS/SS9  U R                  U R                  SSS/SS9  U R                  U R                  S	SS
/SS9  U R                  U R                  SU R                  /SS9  U R                  U R                  S/ SQSS9  g )Nr@   zHello [...]r   	max_linesro   rB   z	how [...]   r   zhow are [...]rF   rA   rM   r)   r&   r;   s    r   rI   MaxLinesTestCase.test_simple  s    		2&"# 	 	% 			2&"# 	 	% 			2'$&"# 	 	% 			2'(*"# 	 	% 			2		{a@		2  #$ 	 	%r   c                     U R                  U R                  S/ SQSS9  U R                  U R                  SSS/SS9  U R                  U R                  S	-   S/ S
QSS9  g )Nr@   )rB   rC   rD   z
day? [...]r[   r   rM   r   [...]r   z
          rA   r   r;   s    r   test_spacesMaxLinesTestCase.test_spaces  sx    		2' #$ 	 	% 			1  ""# 	 	%
 			H,b  #$ 	 	%r   c           
      f   U R                  U R                  SS/SSS9  U R                  U R                  SSS/SSS9  U R                  [        5         [	        U R                  S	S
SSS9  S S S 5        U R                  [        5         [	        U R                  S	S
SSS9  S S S 5        U R                  U R                  S	SS/SS
SSS9  U R                  U R                  S	S/SSS
SS9  U R                  U R                  SU R                  /SS9  g ! , (       d  f       N= f! , (       d  f       N= f)Nr@   zHello...ro   z...r   placeholderrB   z
how are...r   r   r   z [truncated]...)rU   r   r  )r   r   r  z    Hello there,z  [truncated]...r   )r   rU   r   r  rF   a  ........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................r  )r)   r&   r   r   r   r;   s    r   test_placeholder!MaxLinesTestCase.test_placeholder  s=   		2#"#$) 	 	+ 			2'%'"#$)	 	 	+ z*Bv*;= + z*B&*;= + 			2++-"#'-*.$5 	 	7 			2+,"#'+*0$5 	 	7 			2		{
K' +* +*s   DD"
D"
D0c                 2    SnU R                  USSS/SSS9  g )Nz1Good grief Python features are advancing quickly!r@   z
Good griefzPython*****   z*****r  rG   rH   s     r   test_placeholder_backtrack+MaxLinesTestCase.test_placeholder_backtrack2  s-    
 Cb%}5"#$+ 	 	-r   r0   N)
r1   r2   r3   r4   r&   rI   r  r
  r  r5   r0   r   r   r   r     s    JD%2%.L@	-r   r   c                   ,    \ rS rSrS rS rS rS rSrg)LongWordTestCasei>  c                 0    [        5       U l        SU l        g )Nz]Did you say "supercalifragilisticexpialidocious?"
How *do* you spell that odd word, anyways?
)r   r,   r&   r;   s    r   r<   LongWordTestCase.setUp?  s    "}	r   c                     U R                  U R                  S/ SQ5        U R                  U R                  SSS/5        U R                  SS/ SQS	S
9  U R                  U R                  S/ SQ5        g )Nri   )zDid you say "supercalifragiliszticexpialidocious?" How *do*zyou spell that odd word,anyways?r   z1Did you say "supercalifragilisticexpialidocious?"z*How *do* you spell that odd word, anyways?z----------hellor   )z
----------z               hz               e               lr  z               oz               )r   r@   )	Did you say "supercalifragilisticexpzialidocious?z
" How *do*z	you spellzthat oddzword,r  r   r;   s    r   test_break_long LongWordTestCase.test_break_longF  s|     			2%	&
 			2LEG	H 	- -3 	 	4 			2%		&r   c                    SU R                   l        SU R                   l        / SQnU R                   R                  U R                  5      nU R                  X!5        [        U R                  SSS9nU R                  X!5        g )Nr   ri   )zDid you sayz%"supercalifragilisticexpialidocious?"zHow *do* you spell that oddzword, anyways?)r'   rq   )r,   rq   r'   r   r&   r!   r   r    r   s      r   test_nobreak_long"LongWordTestCase.test_nobreak_longj  sg    ()%
 ""499-

6" diirA>

6"r   c                 @    U R                  U R                  S/ SQSS9  g )Nr@   )r  r  r  r  r[   r   r   r;   s    r   test_max_lines_long$LongWordTestCase.test_max_lines_longz  s%    		2" #$ 	 	%r   )r&   r,   N)	r1   r2   r3   r4   r<   r  r  r!  r5   r0   r   r   r  r  >  s    "&H# %r   r  c                   2    \ rS rSrS rS rS rS rS rSr	g)	LongWordWithHyphensTestCasei  c                 >    [        5       U l        SU l        SU l        g )NzOWe used enyzme 2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase.
zC1234567890-1234567890--this_is_a_very_long_option_indeed-good-bye"
)r   r,   text1text2r;   s    r   r<   !LongWordWithHyphensTestCase.setUp  s    "}

r   c                     SS/nU R                  U R                  SU5        / SQnU R                  U R                  SU5        / SQnU R                  U R                  SU5        g )Nz(We used enyzme 2-succinyl-6-hydroxy-2,4-z&cyclohexadiene-1-carboxylate synthase.r   )
We usedz	enyzme 2-z	succinyl-z
6-hydroxy-z2,4-
cyclohexadziene-1-
carboxylate	synthase.r   
1234567890z
-123456789z
0--this_is
_a_very_lo
ng_option_zindeed-z	good-bye"r)   r&  r'  r   expecteds     r   test_break_long_words_on_hyphen;LongWordWithHyphensTestCase.test_break_long_words_on_hyphen  sZ    ><>

B1M

B1:

B1r   c                     SS/nU R                  U R                  SUSS9  / SQnU R                  U R                  SUSS9  / SQnU R                  U R                  SU5        g )	Nz2We used enyzme 2-succinyl-6-hydroxy-2,4-cyclohexadziene-1-carboxylate synthase.r   Fr   )r*  z
enyzme 2-sz
uccinyl-6-z
hydroxy-2,z
4-cyclohexz
adiene-1-c
arboxylater.  r   r/  r3  r4  s     r   #test_break_long_words_not_on_hyphen?LongWordWithHyphensTestCase.test_break_long_words_not_on_hyphen  sb    H24

B5IK

B5I:

B1r   c                     / SQnU R                  U R                  SUSS9  / SQnU R                  U R                  SUSS9  / SQnU R                  U R                  SU5        g )NzWe used enyzme52-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylater.  r   Frp   r*  enyzmer>  r.  r   r/  r3  r4  s     r   'test_break_on_hyphen_but_not_long_wordsCLongWordWithHyphensTestCase.test_break_on_hyphen_but_not_long_words  s_    ! 	

B5I! 	

B5I:

B1r   c                     / SQnU R                  U R                  SUSSS9  / SQnU R                  U R                  SUSSS9  / SQnU R                  U R                  SU5        g )Nr=  r   F)rq   r   r?  r   r/  r3  r4  s     r   *test_do_not_break_long_words_or_on_hyphensFLongWordWithHyphensTestCase.test_do_not_break_long_words_or_on_hyphens  sq    ! 	

B).). 	 	0! 	

B).). 	 	0:

B1r   )r&  r'  r,   N)
r1   r2   r3   r4   r<   r6  r:  rA  rD  r5   r0   r   r   r$  r$    s    222"2r   r$  c                   ,    \ rS rSrS rS rS rS rSrg)IndentTestCasesi  c                     SU l         g )NznThis paragraph will be filled, first without any indentation,
and then with some (including a hanging indent).r&   r;   s    r   r<   IndentTestCases.setUp  s    4	r   c                 V    Sn[        U R                  S5      nU R                  X!5        g )NznThis paragraph will be filled, first
without any indentation, and then with
some (including a hanging indent).re   r   r&   r!   r  s      r   	test_fillIndentTestCases.test_fill  s'    &
 dii$

6"r   c                     / SQn[        U R                  SSS9nU R                  X!5        SR                  U5      n[	        U R                  SSS9nU R                  X!5        g )N)z#     This paragraph will be filled,z'first without any indentation, and thenz'with some (including a hanging indent).re   r   rT   r   )r   r&   r!   r   r   r  s      r   test_initial_indent#IndentTestCases.test_initial_indent  sU    = diiG<

6"6"diiG<

6"r   c                 V    Sn[        U R                  SSSS9nU R                  X!5        g )Nz~  * This paragraph will be filled, first
    without any indentation, and then
    with some (including a hanging
    indent).re   z  * r   r   rL  r  s      r   test_subsequent_indent&IndentTestCases.test_subsequent_indent  s/     dii%+vG

6"r   rI  N)	r1   r2   r3   r4   r<   rM  rP  rS  r5   r0   r   r   rG  rG    s    4	###r   rG  c                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)DedentTestCasei  c                 :    U R                  U[        U5      5        g r$   r   r   rH   s     r   assertUnchangedDedentTestCase.assertUnchanged   s    vd|,r   c                     SnU R                  U5        SnU R                  U5        SnU R                  U5        SnU R                  U5        g )Nz,Hello there.
How are you?
Oh good, I'm glad.zHello there.

Boo!z Hello there.
  This is indented.zHello there.

  Boo!
)rY  rH   s     r   test_dedent_nomargin#DedentTestCase.test_dedent_nomargin  sT    ?T" &T" 3T" *T"r   c                     SnSnU R                  U[        U5      5        SnSnU R                  U[        U5      5        SnSnU R                  U[        U5      5        g )Nz'  Hello there.
  How are ya?
  Oh good.z!Hello there.
How are ya?
Oh good.z)  Hello there.

  How are ya?
  Oh good.
z#Hello there.

How are ya?
Oh good.
z+  Hello there.
  
  How are ya?
  Oh good.
rX  rs   s      r   test_dedent_evenDedentTestCase.test_dedent_even  sa    :6. ?:. A:.r   c                     SnSnU R                  U[        U5      5        SnSnU R                  U[        U5      5        SnSnU R                  U[        U5      5        g )NzK        def foo():
            while 1:
                return foo
        z+def foo():
    while 1:
        return foo
z  Foo
    Bar

   Baz
zFoo
  Bar

 Baz
z  Foo
    Bar
 
   Baz
rX  rs   s      r   test_dedent_uneven!DedentTestCase.test_dedent_uneven%  sf    

 	. ,'. -'.r   c                     SnSnU R                  U[        U5      5        SnSnU R                  U[        U5      5        SnSnU R                  U[        U5      5        g )Nz     Foo
    Bar
z	 Foo
Bar
z     Foo

    Bar
z
 Foo

Bar
z     Foo
    
    Bar
rX  rs   s      r   test_dedent_declining$DedentTestCase.test_dedent_declining=  s`    $. ' . + .r   c                 x    SnSnU R                  U[        U5      5        U R                  U[        U5      5        g )Nz  hello	there
  how are	you?zhello	there
how are	you?rX  rs   s      r   "test_dedent_preserve_internal_tabs1DedentTestCase.test_dedent_preserve_internal_tabsN  s6    0.. 	0r   c                 ~   SnU R                  U5        SnU R                  U5        SnSnU R                  U[        U5      5        SnU R                  U[        U5      5        SnU R                  U[        U5      5        SnSnU R                  U[        U5      5        S	nS
nU R                  U[        U5      5        g )Nz  hello there
	how are you?z!        hello there
	how are you?z	hello there
	how are you?zhello there
how are you?z  	hello there
  	how are you?z"  	  hello there
  	  how are you?z   	hello there
  	  how are you?zhello there
  how are you?z2  	hello there
   	how are you?
 	I'm fine, thanksz/ 	hello there
  	how are you?
	I'm fine, thanks)rY  r   r   rs   s      r    test_dedent_preserve_margin_tabs/DedentTestCase.test_dedent_preserve_margin_tabsZ  s    .T" 5T" /,.2.6.4.. IG.r   r0   N)r1   r2   r3   r4   rY  r\  r_  rb  re  rh  rk  r5   r0   r   r   rV  rV    s%    -#"/ /0/"1/r   rV  c                   d    \ rS rSrSr\S-   rS rS rS rS r	S r
S	 rS
 rS rS rS rS rSrg)IndentTestCaseix  )Hi.
This is a test.
Testing.zHi.
This is a test.

Testing.z
Hi.
This is a test.
Testing.
) Hi.
This is a test.
Testing.
z#
Hi.
This is a test.

Testing.

c                 b    U R                    H  nU R                  [        US5      U5        M!     g NrL   CASESr   r   rH   s     r   test_indent_nomargin_default+IndentTestCase.test_indent_nomargin_default  s'    JJDVD"-t4 r   c                 d    U R                    H   nU R                  [        USS 5      U5        M"     g rr  rs  rH   s     r   %test_indent_nomargin_explicit_default4IndentTestCase.test_indent_nomargin_explicit_default  s+     JJDVD"d3T: r   c                 j    S nU R                    H   nU R                  [        USU5      U5        M"     g )Nc                     gNTr0   lines    r   <lambda>?IndentTestCase.test_indent_nomargin_all_lines.<locals>.<lambda>      r   rL   rs  r   	predicater&   s      r   test_indent_nomargin_all_lines-IndentTestCase.test_indent_nomargin_all_lines  s0     &	JJDVD"i8$? r   c                 j    S nU R                    H   nU R                  [        USU5      U5        M"     g )Nc                     g)NFr0   r}  s    r   r  5IndentTestCase.test_indent_no_lines.<locals>.<lambda>  s    r   r   rs  r  s      r   test_indent_no_lines#IndentTestCase.test_indent_no_lines  s.    &	JJDVD&)<dC r   c           	      t    U R                    H(  nU R                  [        [        US5      5      U5        M*     g )Nr   ROUNDTRIP_CASESr   r   r   rH   s     r   test_roundtrip_spaces$IndentTestCase.test_roundtrip_spaces  .    ((DVF4$894@ )r   c           	      t    U R                    H(  nU R                  [        [        US5      5      U5        M*     g )Nz		r  rH   s     r   test_roundtrip_tabs"IndentTestCase.test_roundtrip_tabs  r  r   c           	      t    U R                    H(  nU R                  [        [        US5      5      U5        M*     g )Nz 	  	 r  rH   s     r   test_roundtrip_mixed#IndentTestCase.test_roundtrip_mixed  s.    ((DVF4$<=tD )r   c                     SnSn[        U R                  U5       H   u  p4U R                  [        X15      U5        M"     g Nr   )"  Hi.
  This is a test.
  Testing.z#  Hi.
  This is a test.

  Testing.z$
  Hi.
  This is a test.
  Testing.
&  Hi.
  This is a test.
  Testing.
z)
  Hi.
  This is a test.

  Testing.

ziprt  r   r   r   prefixr5  r&   r    s        r   test_indent_default"IndentTestCase.test_indent_default  s<    
  

H5LDVD16: 6r   c                     SnSn[        U R                  U5       H!  u  p4U R                  [        X1S 5      U5        M#     g r  r  r  s        r   test_indent_explicit_default+IndentTestCase.test_indent_explicit_default  s>    
  

H5LDVD$7@ 6r   c                     SnSnS n[        U R                  U5       H!  u  pEU R                  [        XAU5      U5        M#     g )Nr   )r  z%  Hi.
  This is a test.
  
  Testing.z&  
  Hi.
  This is a test.
  Testing.
r  z/  
  Hi.
  This is a test.
  
  Testing.
  
c                     gr|  r0   r}  s    r   r  6IndentTestCase.test_indent_all_lines.<locals>.<lambda>  r  r   r  r   r  r5  r  r&   r    s         r   test_indent_all_lines$IndentTestCase.test_indent_all_lines  sC    
 &	

H5LDVD)<fE 6r   c                     SnSnS n[        U R                  U5       H!  u  pEU R                  [        XAU5      U5        M#     g )Nr   )ro  zHi.
This is a test.
  
Testing.z   
Hi.
This is a test.
Testing.
rp  z)  
Hi.
This is a test.
  
Testing.
  
c                 ,    U R                  5       (       + $ r$   )stripr}  s    r   r  8IndentTestCase.test_indent_empty_lines.<locals>.<lambda>  s    TZZ\!1r   r  r  s         r   test_indent_empty_lines&IndentTestCase.test_indent_empty_lines  sC    
 2	

H5LDVD)<fE 6r   r0   N)r1   r2   r3   r4   r  rt  ru  rx  r  r  r  r  r  r  r  r  r  r5   r0   r   r   rn  rn  x  sY    
O   E5
;@DA
A
E
;$A$F&Fr   rn  c                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)ShortenTestCasei  c                 >    [        X40 UD6nU R                  XS5        g r$   )r   r!   r%   s         r   check_shortenShortenTestCase.check_shorten   s    //

6"r   c                     SnU R                  USS5        U R                  U[        U5      U5        U R                  U[        U5      S-
  S5        g )N<Hello there, how are you this fine day? I'm glad to hear it!   zHello there, [...]ro   z9Hello there, how are you this fine day? I'm glad to [...]r  r   rH   s     r   rI   ShortenTestCase.test_simple  sO    M4%9:4TD14TQ 	!r   c                     SnU R                  USSSS9  U R                  USSSS9  U R                  USSS	S9  U R                  U[        U5      USS9  U R                  U[        U5      S
-
  SSS9  g )Nr  r   zHello there,$$z$$r	  r  zHello there, how$$zHello there, $$z $$ro   z:Hello there, how are you this fine day? I'm glad to hear$$r  rH   s     r   r
   ShortenTestCase.test_placeholder  s    M4%54H4%9tL4%6EJ4TDdC4TQ!.2 	 	4r   c                 *    U R                  SSS5        g )NrL   rM   r  r;   s    r   rP   !ShortenTestCase.test_empty_string  s    2q"%r   c                     SnU R                  USS5        U R                  USS5        U R                  SSS5        U R                  SS	S
5        U R                  SSS5        g )Nz[
            This is a  paragraph that  already has
            line breaks and 	 tabs too.>   z>This is a paragraph that already has line breaks and tabs too.=   z:This is a paragraph that already has line breaks and [...]zhello      world!  r@   zhello world!   zhello [...]r   r  r  rH   s     r   r]   ShortenTestCase.test_whitespace  sx    , 	44	5 	40	1 	0"nE0"mD 	0"g>r   c                     [        SSSS9  U R                  [        5         [        SSSS9  S S S 5        g ! , (       d  f       g = f)Nxxxxxxxxxxxxxxxxxxxx   z(......))r'   r  z	(.......))r   r   r   r;   s    r   $test_width_too_small_for_placeholder4ShortenTestCase.test_width_too_small_for_placeholder.  s4    z:z*HA;? +**s	   6
Ac                 *    U R                  SSS5        g )NHelloo   r  r  r;   s    r   -test_first_word_too_long_but_placeholder_fits=ShortenTestCase.test_first_word_too_long_but_placeholder_fits3  s    8Q0r   r0   N)r1   r2   r3   r4   r  rI   r
  rP   r]   r  r  r5   r0   r   r   r  r    s&    #!	4&?$@
1r   r  __main__)unittesttextwrapr   r   r   r   r   r   TestCaser
   r7   r   r  r$  rG  rV  rn  r  r1   mainr0   r   r   <module>r     s     E E;8$$ ;<n0< n0b\-| \-~B% B%JF2, F2P.#l .#fv/X&& v/tCFX&& CFL61l 61r zMMO r   