ó
‹wÛjc           @   s¥   d  d l  Z  d  d l m Z e j d d e ƒZ y d  d l m Z Wn! e k
 rh d  d l m Z n Xd e  j	 f d „  ƒ  YZ
 d „  Z e d	 k r¡ e ƒ  n  d S(
   iÿÿÿÿN(   t   test_supportt   rfc822t
   deprecated(   t   StringIOt   MessageTestCasec           B   s¡   e  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 RS(   c         C   s   t  j t | ƒ ƒ S(   N(   R   t   MessageR   (   t   selft   msg(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   create_message   s    c         C   s†   |  j  d ƒ } |  j | j d ƒ d k ƒ |  j | j d ƒ d k ƒ |  j | j d ƒ d  k ƒ |  j | j d d ƒ d k ƒ d  S(   Ns)   To: "last, first" <userid@foo.net>

test
t   tos   "last, first" <userid@foo.net>t   TOs   No-Such-Headers   No-Such-Value(   R   t
   assertTruet   gett   None(   R   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_get   s    	c         C   s²   |  j  d ƒ } |  j | j d ƒ ƒ |  j | j d d ƒ d k ƒ |  j | j d d ƒ d k ƒ |  j | d d k ƒ |  j | j d ƒ d k ƒ |  j | d d k ƒ d  S(	   Ns)   To: "last, first" <userid@foo.net>

test
s
   New-Headers	   New-Values   Different-Values
   new-headers   Another-Headert    s   another-header(   R   R   t   has_keyt
   setdefault(   R   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_setdefault   s    	
c   
      C   s:  |  j  | ƒ } d } xó | j d ƒ | j d ƒ D]Õ \ } } y! | | d | | d } } Wn- t k
 rŽ d Gt | ƒ Gt | ƒ GHq2 n X| d } |  j | | d | | f ƒ |  j | | d | | f ƒ | | k rî | | k rî q2 d Gt | ƒ Gt | ƒ GHq2 W| j d	 ƒ }	 |	 r6|  j |	 d d ƒ n  d S(   s   Check addresses and the date.i    R	   t   cci   s   extra parsed address:s   Un-expected name: %r != %rs   Un-expected address: %r != %rs
   not found:t   dateiÏ  i   i   i9   i#   s   date conversion failedN(	   iÏ  i   i   i   i9   i#   i    i   i    (   R   t   getaddrlistt
   IndexErrort   reprt   assertEqualt   getdate(
   R   R   t   resultst   mt   it   nt   at   mnt   mat   out(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   check%   s*    )!
	c      	   C   s›   |  j  d d g ƒ |  j  d d g ƒ |  j  d d d g ƒ |  j  d d g ƒ |  j  d
 d  d! d" d# d$ d% g ƒ |  j  d d& g ƒ |  j  d d' g ƒ d  S((   Ns¦   Date:    Wed, 13 Jan 1999 23:57:35 -0500
From:    Guido van Rossum <guido@CNRI.Reston.VA.US>
To:      "Guido van
	 : Rossum" <guido@python.org>
Subject: test2

test2
s   Guido van
	 : Rossums   guido@python.orgs“   From: Barry <bwarsaw@python.org
To: guido@python.org (Guido: the Barbarian)
Subject: nonsense
Date: Wednesday, January 13 1999 23:57:35 -0500

tests   Guido: the Barbariansœ   From: Barry <bwarsaw@python.org
To: guido@python.org (Guido: the Barbarian)
Cc: "Guido: the Madman" <guido@python.org>
Date:  13-Jan-1999 23:57:35 EST

tests   Guido: the Madmansw   To: "The monster with
     the very long name: Guido" <guido@python.org>
Date:    Wed, 13 Jan 1999 23:57:35 -0500

tests/   The monster with
     the very long name: Guidosô   To: "Amit J. Patel" <amitp@Theory.Stanford.EDU>
CC: Mike Fletcher <mfletch@vrtelecom.com>,
        "'string-sig@python.org'" <string-sig@python.org>
Cc: fooz@bat.com, bart@toof.com
Cc: goit@lip.com
Date:    Wed, 13 Jan 1999 23:57:35 -0500

tests   Amit J. Patels   amitp@Theory.Stanford.EDUs   Mike Fletchers   mfletch@vrtelecom.coms   'string-sig@python.org's   string-sig@python.orgR   s   fooz@bat.coms   bart@toof.coms   goit@lip.comsV   To: Some One <someone@dom.ain>
From: Anudder Persin <subuddy.else@dom.ain>
Date:

tests   Some Ones   someone@dom.ains%   To: person@dom.ain (User J. Person)

s   User J. Persons   person@dom.ain(   s   Guido van
	 : Rossums   guido@python.org(   s   Guido: the Barbarians   guido@python.org(   s   Guido: the Barbarians   guido@python.org(   s   Guido: the Madmans   guido@python.org(   s/   The monster with
     the very long name: Guidos   guido@python.org(   s   Amit J. Patels   amitp@Theory.Stanford.EDU(   s   Mike Fletchers   mfletch@vrtelecom.com(   s   'string-sig@python.org's   string-sig@python.org(   R   s   fooz@bat.com(   R   s   bart@toof.com(   R   s   goit@lip.com(   s   Some Ones   someone@dom.ain(   s   User J. Persons   person@dom.ain(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt
   test_basicC   s8    


 


c         C   s   |  j  d d d g ƒ d  S(   Ns?   To: person@dom.ain ((User J. Person)), John Doe <foo@bar.com>

s   User J. Persons   person@dom.ains   John Does   foo@bar.com(   s   User J. Persons   person@dom.ain(   s   John Does   foo@bar.com(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_doublecommentˆ   s    c         C   s   |  j  d d d d g ƒ d  S(   Nsr   To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com>
Date:    Wed, 13 Jan 1999 23:57:35 -0500

testR   s   dd47@mail.xxx.edus%   _at_hmhq@hdq-mdm1-imgout.companay.com(   R   R   (   R   s   dd47@mail.xxx.edu(   R   s%   _at_hmhq@hdq-mdm1-imgout.companay.com(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_twistedŽ   s
    c         C   s   |  j  d d g ƒ d  S(   Ns(   To: "last, first" <userid@foo.net>

tests   last, firsts   userid@foo.net(   s   last, firsts   userid@foo.net(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_commas_in_full_nameœ   s    c         C   s   |  j  d d g ƒ d  S(   Ns5   To: (Comment stuff) "Quoted name"@somewhere.com

tests   Comment stuffs   "Quoted name"@somewhere.com(   s   Comment stuffs   "Quoted name"@somewhere.com(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_quoted_name¦   s    c         C   s   |  j  d d g ƒ d  S(   NsE   To: :
Cc: goit@lip.com
Date:    Wed, 13 Jan 1999 23:57:35 -0500

testR   s   goit@lip.com(   R   s   goit@lip.com(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_bogus_to_header­   s    c         C   s   |  j  d d g ƒ d  S(   Ns   To: guido@[132.151.1.21]

fooR   s   guido@[132.151.1.21](   R   s   guido@[132.151.1.21](   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_addr_ipquad¶   s    c         C   s;   t  j t d ƒ ƒ } |  j t | ƒ d d d d g ƒ d  S(   Ns¦   Date:    Wed, 13 Jan 1999 23:57:35 -0500
From:    Guido van Rossum <guido@CNRI.Reston.VA.US>
To:      "Guido van
	 : Rossum" <guido@python.org>
Subject: test2

test2
R   t   fromt   subjectR	   (   R   R   R   R   t   sorted(   R   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt	   test_iter½   s    	c         C   s   |  j  d d g ƒ d  S(   Ns%   To: User J. Person <person@dom.ain>

s   User J. Persons   person@dom.ain(   s   User J. Persons   person@dom.ain(   R"   (   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_rfc2822_phrasesÈ   s    	c         C   s�   |  j  } |  j d ƒ } g  d d d g D] } d | f ^ q( } | j d ƒ } | j ƒ  | | | ƒ | j d ƒ } | j ƒ  | | | ƒ d  S(   Nsa   To: aperson@dom.ain
Cc: bperson@dom.ain
Cc: cperson@dom.ain
Cc: dperson@dom.ain

A test message.
s   bperson@dom.ains   cperson@dom.ains   dperson@dom.ainR   R   (   R   R   R   t   sort(   R   t   eqR   R   t   ccst   addrs(    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_2getaddrlistÙ   s    		%

c         C   se   |  j  } | t j d ƒ d
 ƒ | t j d ƒ d ƒ | t j d ƒ d ƒ | t j d ƒ d ƒ d  S(   Ns   <>R   s   aperson@dom.ains   bperson@dom.ain (Bea A. Person)s   Bea A. Persons   bperson@dom.ains    Cynthia Person <cperson@dom.ain>s   Cynthia Persons   cperson@dom.ain(   R   R   (   R   s   aperson@dom.ain(   s   Bea A. Persons   bperson@dom.ain(   s   Cynthia Persons   cperson@dom.ain(   R   R   t	   parseaddr(   R   R0   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_parseaddrí   s    	c         C   s9   |  j  } | t j d ƒ d ƒ | t j d ƒ d ƒ d  S(   Ns   foo\wacky"names   foo\\wacky\"names   "foo\\wacky\"name"(   R   R   t   quotet   unquote(   R   R0   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_quote_unquoteö   s    	c         C   sH   |  j  } |  j d ƒ } | | j d ƒ d ƒ | | j d ƒ d ƒ d  S(   Ns#   First: val
: otherval
Second: val2
t   Firstt   valt   Secondt   val2(   R   R   t	   getheader(   R   R0   R   (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   test_invalid_headersû   s    	(   t   __name__t
   __module__R   R   R   R"   R#   R$   R%   R&   R'   R(   R)   R-   R.   R3   R5   R8   R>   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyR      s"   						E			
										c           C   s   t  j t ƒ d  S(   N(   R    t   run_unittestR   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt	   test_main  s    t   __main__(   t   unittestt   testR    t   import_modulet   TrueR   t	   cStringIOR   t   ImportErrort   TestCaseR   RB   R?   (    (    (    s†   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_rfc822.pyt   <module>   s   ö	