Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/test_email/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/test_email/__pycache__/test_generator.cpython-34.pyo

�
f f��@s�ddlZddlZddlZddlmZmZddlmZmZddlm	Z	ddl
mZmZeGdd�d��Z
Gdd	�d	e
e�ZGd
d�de
e�Zedkr�ej�ndS)
�N)�message_from_string�message_from_bytes)�	Generator�BytesGenerator)�policy)�
TestEmailBase�parameterizec@s�eZdZejZddd�Ziejd�d6ejd�d6ejd�d	6Zeded
<ej	�Z
de
d<de
d
<d
d�eD�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�TestGeneratorBaseNcCs.|dkr|jn|}|j|d|�S)Nr)r�msgfunc)�self�msgr�r
�C/opt/alt/python34/lib64/python3.4/test/test_email/test_generator.py�msgmakerszTestGeneratorBase.msgmakeraf            To: whom_it_may_concern@example.com
            From: nobody_you_want_to_know@example.com
            Subject: We the willing led by the unknowing are doing the
             impossible for the ungrateful. We have done so much for so long with so little
             we are now qualified to do anything with nothing.

            None
            ra�            To: whom_it_may_concern@example.com
            From:
             nobody_you_want_to_know@example.com
            Subject: We the willing led by the
             unknowing are doing the impossible for
             the ungrateful. We have done so much
             for so long with so little we are now
             qualified to do anything with nothing.

            None
            �(a�            To: whom_it_may_concern@example.com
            From: nobody_you_want_to_know@example.com
            Subject: We the
             willing led by the
             unknowing are doing
             the impossible for
             the ungrateful. We
             have done so much
             for so long with so
             little we are now
             qualified to do
             anything with
             nothing.

            None
            ��daTo: whom_it_may_concern@example.com
From: nobody_you_want_to_know@example.com
Subject: We the willing led by the unknowing are doing the impossible for the ungrateful. We have done so much for so long with so little we are now qualified to do anything with nothing.

None
aTo: whom_it_may_concern@example.com
From: nobody_you_want_to_know@example.com
Subject: We the willing led by the unknowing are doing the impossible for the ungrateful. We have
 done so much for so long with so little we are now qualified to do anything with nothing.

None
cCsg|]}|�qSr
r
)�.0�nr
r
r�
<listcomp>Ts	zTestGeneratorBase.<listcomp>cCs�|j|j|jd��}|j�}|j|d|d|j�}|j|�|j|j�|j|j|��dS)Nr�maxheaderlenr)	r�typ�refold_long_expected�ioclass�genclassr�flatten�assertEqual�getvalue)rrr�s�gr
r
r� length_as_maxheaderlen_parameterVs

z2TestGeneratorBase.length_as_maxheaderlen_parametercCs�|j|j|jd��}|j�}|j|d|jjd|��}|j|�|j|j	�|j|j|��dS)Nrr�max_line_length)
rrrrrr�clonerrr)rrrrrr
r
r� length_as_max_line_length_policy]s
$
z2TestGeneratorBase.length_as_max_line_length_policycCs�|j|j|jd��}|j�}|j|d|d|jjdd��}|j|�|j|j	�|j|j|��dS)Nrrrr!�
)
rrrrrrr"rrr)rrrrrr
r
r�,length_as_maxheaderlen_parm_overrides_policyds
z>TestGeneratorBase.length_as_maxheaderlen_parm_overrides_policycCs�|j|j|jd��}|j�}|j|d|jjddd|��}|j|�|j|j	�|j|jd��dS)Nrr�
refold_sourceZnoner!)
rrrrrrr"rrr)rrrrrr
r
r�8length_as_max_line_length_with_refold_none_does_not_foldls
zJTestGeneratorBase.length_as_max_line_length_with_refold_none_does_not_foldcCs�|j|j|jd��}|j�}|j|d|jjddd|��}|j|�|j|j	�|j|j
|��dS)Nrrr&�allr!)rrrrrrr"rrr�refold_all_expected)rrrrrr
r
r�/length_as_max_line_length_with_refold_all_foldsts
zATestGeneratorBase.length_as_max_line_length_with_refold_all_foldscCsxd}|}|j|j|��}|j�}|j|dtj�}|j|�|j|j�|j|��dS)NzSubject: test

test body
r)	rrrrr�SMTPrrr)r�source�expectedrrrr
r
r�test_crlf_control_via_policy|s
z.TestGeneratorBase.test_crlf_control_via_policycCs~d}|}|j|j|��}|j�}|j|dtj�}|j|dd�|j|j�|j|��dS)NzSubject: test

test body
r�linesep�
)	rrrrrr+rrr)rr,r-rrrr
r
r�%test_flatten_linesep_overrides_policy�sz7TestGeneratorBase.test_flatten_linesep_overrides_policy)�__name__�
__module__�__qualname__r�defaultr�textwrap�dedentr�copyr)Z
length_paramsr r#r%r'r*r.r1r
r
r
rr	
s*	



	
		r	c@s1eZdZee�ZeZej	Z
eZdS)�
TestGeneratorN)
r2r3r4�staticmethodrr
rr�io�StringIOr�strrr
r
r
rr9�s	r9c@sOeZdZee�ZeZej	Z
dd�Zdd�Zdd�Z
dS)�TestBytesGeneratorcCs
|jd�S)N�ascii)�encode)r�xr
r
r�<lambda>�szTestBytesGenerator.<lambda>cCs~djd�}djd�}t|�}tj�}t|d|jjdd��}|j|�|j|j	�|�dS)Nu5Subject: Maintenant je vous présente mon collègue

zutf-8zPSubject: Maintenant je vous =?unknown-8bit?q?pr=C3=A9sente_mon_coll=C3=A8gue?=

r?r�cte_type�7bit)
r@rr;�BytesIOrrr"rrr)rr,r-rrrr
r
r�'test_cte_type_7bit_handles_unknown_8bit�s		!
z:TestBytesGenerator.test_cte_type_7bit_handles_unknown_8bitcCs�tjd�jd�}t|�}tjd�jd�}tj�}t|d|jjdddd	��}|j	|�|j
|j�|�dS)
Nu/            From: foo@bar.com
            To: Dinsdale
            Subject: Nudge nudge, wink, wink
            Mime-Version: 1.0
            Content-Type: text/plain; charset="latin-1"
            Content-Transfer-Encoding: 8bit

            oh là là, know what I mean, know what I mean?
            �latin1a@            From: foo@bar.com
            To: Dinsdale
            Subject: Nudge nudge, wink, wink
            Mime-Version: 1.0
            Content-Type: text/plain; charset="iso-8859-1"
            Content-Transfer-Encoding: quoted-printable

            oh l=E0 l=E0, know what I mean, know what I mean?
            r?rrCrDr/r0)r6r7r@rr;rErrr"rrr)rr,rr-rrr
r
r�&test_cte_type_7bit_transforms_8bit_cte�s		
z9TestBytesGenerator.test_cte_type_7bit_transforms_8bit_cteN)r2r3r4r:rr
rrr;rErrrFrHr
r
r
rr>�s	r>�__main__)r;r6ZunittestZemailrrZemail.generatorrrrZtest.test_emailrrr	r9r>r2�mainr
r
r
r�<module>s�/