;
Íâ"Ic               @   sÈ   d  d l  Z  d  d l m Z d  d l m Z m Z m Z m Z Gd „  d e  j ƒ Z	 Gd „  d e	 ƒ Z
 Gd „  d	 e	 ƒ Z Gd
 „  d e	 ƒ Z Gd „  d e  j ƒ Z d „  Z e d k o e ƒ  n d S(   i    N(   u   support(   u   TextWrapperu   wrapu   fillu   dedentc             B   s8   |  Ee  Z d  Z d „  Z d „  Z d „  Z d „  Z d S(   u5   Parent class with utility methods for textwrap tests.c             C   s‰   t  | t ƒ oQ g  } x5 t t | ƒ ƒ D]! } | j d | | | f ƒ q) Wd j | ƒ } n% t  | t ƒ o d t | ƒ } n | S(   Nu     %d: %ru   
u     %s
(   u
   isinstanceu   listu   rangeu   lenu   appendu   joinu   stru   repr(   u   selfu   textinu   resultu   i(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   show   s     c             C   s3   |  j  | | d |  j | ƒ |  j | ƒ f ƒ d  S(   Nu   expected:
%s
but got:
%s(   u   assertEqualsu   show(   u   selfu   resultu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   check   s    c             K   s&   t  | | |  } |  j | | ƒ d  S(   N(   u   wrapu   check(   u   selfu   textu   widthu   expectu   kwargsu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu
   check_wrap$   s    c             C   s3   |  j  j | ƒ } |  j | | d | | f ƒ d  S(   Nu   
expected %r
but got  %r(   u   wrapperu   _splitu   assertEquals(   u   selfu   textu   expectu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   check_split(   s    N(   u   __name__u
   __module__u   __doc__u   showu   checku
   check_wrapu   check_split(   u
   __locals__(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   BaseTestCase   s
   
			u   BaseTestCasec             B   s°   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   c             C   s   t  d d ƒ |  _ d  S(   Nu   widthi-   (   u   TextWrapperu   wrapper(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   setUp1   s    c          	   C   s^   d } |  j  | d d d d d d d g ƒ |  j  | d	 d
 d g ƒ |  j  | d | g ƒ d  S(   Nu=   Hello there, how are you this fine day?  I'm glad to hear it!i   u   Hello there,u   how are youu	   this fineu	   day?  I'mu   glad to hearu   it!i*   u'   Hello there, how are you this fine day?u   I'm glad to hear it!iP   (   u
   check_wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_simple4   s    

c             C   sx   d } d d d d d g } t  d d d
 ƒ} | j | ƒ } |  j | | ƒ | j | ƒ } |  j | d	 j | ƒ ƒ d  S(   Nu®   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!
u)   This is a paragraph that already has lineu'   breaks.  But some of its lines are muchu)   longer than the others, so it needs to beu-   wrapped.  Some lines are  tabbed too.  What au   mess!i-   u   fix_sentence_endingsu   
T(   u   TextWrapperu   Trueu   wrapu   checku   fillu   join(   u   selfu   textu   expectu   wrapperu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_whitespaceF   s    		c             C   s_  t  d d d ƒ} d } d g } |  j | j | ƒ | ƒ d } d g } |  j | j | ƒ | ƒ d } |  j | j | ƒ | ƒ d } d	 g } |  j | j | ƒ | ƒ d
 | _ d d d g } |  j | j | ƒ | ƒ d } d d d g } |  j | j | ƒ | ƒ d | _ d g } |  j | j | ƒ | ƒ d } d g } |  j | j | ƒ | ƒ d  S(   Ni<   u   fix_sentence_endingsu$   A short line. Note the single space.u%   A short line.  Note the single space.u    Well, Doctor? What do you think?u!   Well, Doctor?  What do you think?u    Well, Doctor?
What do you think?u)   I say, chaps! Anyone for "tennis?"
Hmmph!u+   I say, chaps!  Anyone for "tennis?"  Hmmph!i   u   I say, chaps!u   Anyone for "tennis?"u   Hmmph!u1   And she said, "Go to hell!"
Can you believe that?u   And she said, "Go tou   hell!"  Can youu   believe that?u2   And she said, "Go to hell!"  Can you believe that?u   File stdio.h is nice.T(   u   TextWrapperu   Trueu   checku   wrapu   width(   u   selfu   wrapperu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_fix_sentence_endings^   s4    								c             C   s9   d } |  j  | d d d g ƒ |  j  | d d g ƒ d  S(   Nu   This is a
short paragraph.i   u   This is a shortu
   paragraph.i(   u   This is a short paragraph.(   u
   check_wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_wrap_shortˆ   s    
c             C   s<   d } |  j  | d d g ƒ |  j  | d d g d d ƒd  S(   Nu   This is a short line.i   u   (1) This is a short line.u   initial_indentu   (1) (   u
   check_wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_wrap_short_1line’   s    c             C   sU   d } |  j  | d d d g ƒ |  j  | d d d g ƒ |  j  | d d d g ƒ d  S(	   NuB   this-is-a-useful-feature-for-reformatting-posts-from-tim-peters'lyi(   u   this-is-a-useful-feature-for-u%   reformatting-posts-from-tim-peters'lyi)   i*   u*   this-is-a-useful-feature-for-reformatting-u   posts-from-tim-peters'ly(   u
   check_wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_hyphenatedœ   s    

c             C   s   d } |  j  | d d d d g ƒ |  j  | d d d g ƒ d	 } |  j  | d
 d d g ƒ |  j  | d d d g ƒ |  j  | d d	 g ƒ d  S(   NuR   Python 1.0.0 was released on 1994-01-26.  Python 1.0.1 was
released on 1994-02-15.i   u   Python 1.0.0 was released onu   1994-01-26.  Python 1.0.1 wasu   released on 1994-02-15.i(   u(   Python 1.0.0 was released on 1994-01-26.u(   Python 1.0.1 was released on 1994-02-15.u   I do all my shopping at 7-11.i   u   I do all my shopping atu   7-11.i   i   (   u
   check_wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_hyphenated_numbers¬   s    



c             C   sç  d } |  j  | d d d g ƒ |  j  | d d d g ƒ d d	 g } |  j  | d
 | ƒ |  j  | d | ƒ |  j  | d d g ƒ d } d d d g } |  j  | d | ƒ |  j  | d | ƒ d d d g } |  j  | d | ƒ |  j  | d | ƒ d d g } |  j  | d | ƒ |  j  | d | ƒ d d g } |  j  | d | ƒ |  j  | d | ƒ d } d d d d d  d d! d" d d# d  d$ d d% d& d# d d' g } |  j | | ƒ d( } d# d d) d  d* d  d+ d d, d d- g } |  j | | ƒ d  S(.   Nu$   Em-dashes should be written -- thus.i   u   Em-dashes should beu   written -- thus.i   u   Em-dashes should be writtenu   -- thus.u   Em-dashes should be written --u   thus.i   i#   i$   u%   You can also do--this or even---this.u   You can also dou   --this or evenu   ---this.i   i   u   You can also do--u   this or even---u   this.i   i   u   You can also do--this or eveni   u    You can also do--this or even---i    u7   Here's an -- em-dash and--here's another---and another!u   Here'su    u   anu   --u   em-u   dashu   andu   here'su   anotheru   ---u   another!u   and then--bam!--he was goneu   thenu   bam!u   heu   wasu   gone(   u
   check_wrapu   check_split(   u   selfu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_em_dash¾   sR    

	
				c             C   s4  d } |  j  | d d d d d g ƒ |  j  | d d d	 d
 g ƒ d d g } |  j  | d | ƒ |  j  | d | ƒ |  j  | d | ƒ |  j  | d | ƒ d d g } |  j  | d | ƒ |  j  | d | ƒ d d
 g } |  j  | d | ƒ d } d d d d d d d d d d d d d d g } |  j | | ƒ d  S(    Nu<   You should use the -n option, or --dry-run in its long form.i   u   You should use theu   -n option, or --dry-u   run in its longu   form.i   u   You should use the -nu   option, or --dry-runu   in its long form.u    You should use the -n option, oru   --dry-run in its long form.i    i"   i#   i&   u'   You should use the -n option, or --dry-u   run in its long form.i'   i)   u*   You should use the -n option, or --dry-runi*   u'   the -n option, or --dry-run or --dryrunu   theu    u   -nu   option,u   oru   --dry-u   runu   --dryrun(   u
   check_wrapu   check_split(   u   selfu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_unix_optionsõ   s6    

			c             C   s³   |  j  d d d d d d g ƒ |  j  d d d d g ƒ |  j  d	 d d d
 g ƒ |  j  d d g ƒ |  j  d d g ƒ |  j  d d d g ƒ |  j  d d d d d d d g ƒ d  S(   Nu   what the--hey!u   whatu    u   theu   --u   hey!u
   what the--u   the--u   what the--.u   the--.u	   --text--.u   --optionu   --option-optu	   --option-u   optu   foo --option-opt baru   foou   bar(   u   check_split(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_funky_hyphens  s    	c             C   sŒ   |  j  d d d d d d d g ƒ |  j  d d d d d	 d d g ƒ |  j  d
 d d d d d d g ƒ |  j  d d d d d d d g ƒ d  S(   Nu   the 'wibble-wobble' widgetu   theu    u   'wibble-u   wobble'u   widgetu   the "wibble-wobble" widgetu   "wibble-u   wobble"u   the (wibble-wobble) widgetu   (wibble-u   wobble)u   the ['wibble-wobble'] widgetu	   ['wibble-u   wobble'](   u   check_split(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_punct_hyphens(  s    				c          	   C   sg   |  j  d d d d d d g ƒ |  j  d d d d d d g ƒ |  j  d	 d
 d d d d d d g ƒ d  S(   Nu   foo (--option) baru   foou    u
   (--option)u   baru   foo (bar) bazu   (bar)u   bazu   blah (ding dong), wubbau   blahu   (dingu   dong),u   wubba(   u   check_split(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_funky_parens9  s    			c             C   s9   d } |  j  | d d g ƒ |  j  | d d d g ƒ d  S(   Nu,    This is a sentence with leading whitespace.i2   i   u    This is a sentence withu   leading whitespace.(   u
   check_wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_initial_whitespaceF  s
    
c          	   C   s5   d } |  j  | d d d d d d d g d	 d
 ƒd  S(   Nu0    This is a    sentence with     much whitespace.i
   u
    This is au       u	   sentence u	   with     u
   much whiteu   space.u   drop_whitespaceF(   u
   check_wrapu   False(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_no_drop_whitespaceO  s
    	c             C   sb   d } |  j  j | ƒ } |  j | d d d d d d d d d d d d	 d d
 d d d d g ƒ d  S(   Nu0   Hello there -- you goof-ball, use the -b option!u   Hellou    u   thereu   --u   youu   goof-u   ball,u   useu   theu   -bu   option!(   u   wrapperu   _splitu   check(   u   selfu   textu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu
   test_splitW  s
    	c             C   sH   d } |  j  | d d d g d d ƒ|  j  | d d d g d d	 ƒd  S(
   Nu   yaba daba-dooi
   u
   yaba daba-u   doou   break_on_hyphensu   yabau   daba-dooTF(   u
   check_wrapu   Trueu   False(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_break_on_hyphensb  s
    c             C   s6   d } |  j  t t | d ƒ |  j  t t | d ƒ d  S(   Nu   Whatever, it doesn't matter.i    iÿÿÿÿ(   u   assertRaisesu
   ValueErroru   wrap(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_bad_widthj  s    N(   u   __name__u
   __module__u   setUpu   test_simpleu   test_whitespaceu   test_fix_sentence_endingsu   test_wrap_shortu   test_wrap_short_1lineu   test_hyphenatedu   test_hyphenated_numbersu   test_em_dashu   test_unix_optionsu   test_funky_hyphensu   test_punct_hyphensu   test_funky_parensu   test_initial_whitespaceu   test_no_drop_whitespaceu
   test_splitu   test_break_on_hyphensu   test_bad_width(   u
   __locals__(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   WrapTestCase/   s$   
				*	
	
			7	"								u   WrapTestCasec             B   s)   |  Ee  Z d  „  Z d „  Z d „  Z d S(   c             C   s   t  ƒ  |  _ d |  _ d  S(   Nu]   Did you say "supercalifragilisticexpialidocious?"
How *do* you spell that odd word, anyways?
(   u   TextWrapperu   wrapperu   text(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   setUpr  s    c             C   sž   |  j  |  j d d d d d g ƒ |  j  |  j d d d g ƒ |  j  d d
 d d d d d d g d d ƒ|  j  |  j d d d d d d d d d d g	 ƒ d  S(    Ni   u   Did you say "supercalifragilisu   ticexpialidocious?" How *do*u   you spell that odd word,u   anyways?i2   u1   Did you say "supercalifragilisticexpialidocious?"u*   How *do* you spell that odd word, anyways?u   -i
   u   hellou
   ----------u                  hu                  eu                  lu                  ou   subsequent_indentu    i   i   u   Did you say u   "supercalifru   agilisticexpu   ialidocious?u
   " How *do*u	   you spellu   that oddu   word,u
   ----------u   ----------hellou                  (   u
   check_wrapu   text(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_break_longy  s4    

	c             C   s~   d |  j  _ d |  j  _ d d d d g } |  j  j |  j ƒ } |  j | | ƒ t |  j d d d d ƒ} |  j | | ƒ d  S(	   Ni    i   u   Did you sayu%   "supercalifragilisticexpialidocious?"u   How *do* you spell that oddu   word, anyways?u   widthu   break_long_words(   u   wrapperu   break_long_wordsu   widthu   wrapu   textu   check(   u   selfu   expectu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_nobreak_long  s    	N(   u   __name__u
   __module__u   setUpu   test_break_longu   test_nobreak_long(   u
   __locals__(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   LongWordTestCaseq  s   
		$u   LongWordTestCasec             B   s2   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d S(   c             C   s   d |  _  d  S(   Nun   This paragraph will be filled, first without any indentation,
and then with some (including a hanging indent).(   u   text(   u   self(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   setUp±  s    c             C   s,   d } t  |  j d ƒ } |  j | | ƒ d  S(   Nun   This paragraph will be filled, first
without any indentation, and then with
some (including a hanging indent).i(   (   u   fillu   textu   check(   u   selfu   expectu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu	   test_fill·  s    c             C   sr   d d d g } t  |  j d d d ƒ} |  j | | ƒ d j | ƒ } t |  j d d d ƒ} |  j | | ƒ d  S(   Nu#        This paragraph will be filled,u'   first without any indentation, and thenu'   with some (including a hanging indent).i(   u   initial_indentu        u   
(   u   wrapu   textu   checku   joinu   fill(   u   selfu   expectu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_initial_indentÃ  s    	c             C   s8   d } t  |  j d d d d d ƒ} |  j | | ƒ d  S(   Nu~     * This paragraph will be filled, first
    without any indentation, and then
    with some (including a hanging
    indent).i(   u   initial_indentu     * u   subsequent_indentu       (   u   fillu   textu   check(   u   selfu   expectu   result(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_subsequent_indentÑ  s    N(   u   __name__u
   __module__u   setUpu	   test_fillu   test_initial_indentu   test_subsequent_indent(   u
   __locals__(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   IndentTestCases®  s   
			u   IndentTestCasesc             B   sD   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   c             C   s   |  j  | t | ƒ ƒ d S(   u,   assert that dedent() has no effect on 'text'N(   u   assertEqualsu   dedent(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   assertUnchangedã  s    c             C   sP   d } |  j  | ƒ d } |  j  | ƒ d } |  j  | ƒ d } |  j  | ƒ d  S(   Nu,   Hello there.
How are you?
Oh good, I'm glad.u   Hello there.

Boo!u    Hello there.
  This is indented.u   Hello there.

  Boo!
(   u   assertUnchanged(   u   selfu   text(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_dedent_nomarginç  s    c             C   sj   d } d } |  j  | t | ƒ ƒ d } d } |  j  | t | ƒ ƒ d } d } |  j  | t | ƒ ƒ d  S(   Nu'     Hello there.
  How are ya?
  Oh good.u!   Hello there.
How are ya?
Oh good.u)     Hello there.

  How are ya?
  Oh good.
u#   Hello there.

How are ya?
Oh good.
u+     Hello there.
  
  How are ya?
  Oh good.
(   u   assertEqualsu   dedent(   u   selfu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_dedent_evenø  s    c             C   sj   d } d } |  j  | t | ƒ ƒ d } d } |  j  | t | ƒ ƒ d } d } |  j  | t | ƒ ƒ d  S(   NuK           def foo():
            while 1:
                return foo
        u+   def foo():
    while 1:
        return foo
u     Foo
    Bar

   Baz
u   Foo
  Bar

 Baz
u     Foo
    Bar
 
   Baz
(   u   assertEqualsu   dedent(   u   selfu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   test_dedent_uneven  s    c             C   s<   d } d } |  j  | t | ƒ ƒ |  j  | t | ƒ ƒ d  S(   Nu     hello	there
  how are	you?u   hello	there
how are	you?(   u   assertEqualsu   dedent(   u   selfu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu"   test_dedent_preserve_internal_tabs!  s    c             C   s¦   d } |  j  | ƒ d } |  j  | ƒ d } d } |  j | t | ƒ ƒ d } |  j | t | ƒ ƒ d } |  j | t | ƒ ƒ d } d } |  j | t | ƒ ƒ d  S(	   Nu     hello there
	how are you?u!           hello there
	how are you?u   	hello there
	how are you?u   hello there
how are you?u     	hello there
  	how are you?u"     	  hello there
  	  how are you?u      	hello there
  	  how are you?u   hello there
  how are you?(   u   assertUnchangedu   assertEqualsu   dedent(   u   selfu   textu   expect(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu    test_dedent_preserve_margin_tabs-  s    N(   u   __name__u
   __module__u   assertUnchangedu   test_dedent_nomarginu   test_dedent_evenu   test_dedent_unevenu"   test_dedent_preserve_internal_tabsu    test_dedent_preserve_margin_tabs(   u
   __locals__(    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   DedentTestCaseá  s   
					u   DedentTestCasec               C   s   t  j t t t t ƒ d  S(   N(   u   supportu   run_unittestu   WrapTestCaseu   LongWordTestCaseu   IndentTestCasesu   DedentTestCase(    (    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu	   test_mainE  s    	u   __main__(   u   unittestu   testu   supportu   textwrapu   TextWrapperu   wrapu   fillu   dedentu   TestCaseu   BaseTestCaseu   WrapTestCaseu   LongWordTestCaseu   IndentTestCasesu   DedentTestCaseu	   test_mainu   __name__(    (    (    u/   /mit/python/lib/python3.0/test/test_textwrap.pyu   <module>   s   "ÿ C=3d	