a
    ze	                     @   s   d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
mZ eG dd de
ZeG dd de
Zed	kre   dS )
    Npolicy)HeaderRegistry)TestEmailBaseparameterizec                   @   s:   e Zd Ze ZeddZdddddZdd	 Zd
d ZdS )TestPickleCopyHeadersubjectthis is a test)r   r	   )fromfrodo@mordor.net)toza: k@b.com, y@z.com;, j@f.com)dateTue, 29 May 2012 09:24:26 +1000)r   r
   r   r   c                 C   s.   |  ||}t|}| t|t| d S N)header_factorycopydeepcopyassertEqualstr)selfnamevalueheaderh r   5/usr/lib/python3.9/test/test_email/test_pickleable.pyheader_as_deepcopy   s    
z'TestPickleCopyHeader.header_as_deepcopyc                 C   sN   |  ||}ttjd D ].}t||}t|}| t|t| qd S N   )r   rangepickleHIGHEST_PROTOCOLdumpsloadsr   r   )r   r   r   r   protopr   r   r   r   header_as_pickle   s
    
z%TestPickleCopyHeader.header_as_pickleN)	__name__
__module____qualname__r   r   ZunstructuredZheader_paramsr   r&   r   r   r   r   r      s   
r   c                   @   s   e Zd Zi Zejedej	dfed< ej
jej	dfed< ded d d< ded d d	< d
ed d d< ded d d< ed d d dd Zdd ZdS )TestPickleCopyMessagez        Date: Tue, 29 May 2012 09:24:26 +1000
        From: frodo@mordor.net
        To: bilbo@underhill.org
        Subject: help

        I think I forgot the ring.
        r   parsedcreatedr   r   ZDater   ZFromzbilbo@underhill.orgZTohelpZSubjectzI think I forgot the ring.c                 C   s"   t |}| | |  d S r   )r   r   r   	as_string)r   msgmsg2r   r   r   msg_as_deepcopy@   s    
z%TestPickleCopyMessage.msg_as_deepcopyc                 C   sB   t tjd D ].}t||}t|}| | |  qd S r   )r   r    r!   r"   r#   r   r.   )r   r/   r$   r%   r0   r   r   r   msg_as_pickleD   s    
z#TestPickleCopyMessage.msg_as_pickleN)r'   r(   r)   Z
msg_paramsemailZmessage_from_stringtextwrapdedentr   defaultmessageZMessageZset_payloadr1   r2   r   r   r   r   r*   '   s   	r*   __main__)Zunittestr4   r   r    r3   Zemail.messager   Zemail.headerregistryr   Ztest.test_emailr   r   r   r*   r'   mainr   r   r   r   <module>   s   #