a
    	3j                     @   s   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 d dl	Z	d dl	m
Z d dlmZ dd Zzed	 W n ey   ejY n0 G d
d deZG dd deZdd Zdd Zdd Zedkrejdd dS )    N)StringIO)TestEmailBase)run_unittest)__file__)
_structurec                 C   s6   ddl m}m}m} |||ttjd| }t|dS )Nr   )joindirnameabspathZmoredatar)Zos.pathr   r   r	   testfileospardiropen)filenamer   r   r	   path r   X/www/server/python_manager/versions/3.9.10/lib/python3.9/test/test_email/torture_test.pyopenfile   s    r   crispin-torture.txtc                   @   s   e Zd Zdd ZdS )TortureBasec                 C   s.   t |}zt|}W |  n
|  0 |S N)r   emailZmessage_from_fileclose)selfr   fpmsgr   r   r   _msgobj#   s
    zTortureBase._msgobjN)__name__
__module____qualname__r   r   r   r   r   r   "   s   r   c                   @   s   e Zd Zdd ZdS )TestCrispinTorturec                 C   sv   | j }| j}| d}| }|t|t |t|d ||jd  ||jd t	 }t
||d || d d S )Nr      
)r   a:  multipart/mixed
    text/plain
    message/rfc822
        multipart/alternative
            text/plain
            multipart/mixed
                text/richtext
            application/andrew-inset
    message/rfc822
        audio/basic
    audio/basic
    image/pbm
    message/rfc822
        multipart/mixed
            multipart/mixed
                text/plain
                audio/x-sun
            multipart/mixed
                image/gif
                image/gif
                application/x-be2
                application/atomicmail
            audio/x-sun
    message/rfc822
        multipart/mixed
            text/plain
            image/pgm
            text/plain
    message/rfc822
        multipart/mixed
            text/plain
            image/pbm
    message/rfc822
        application/postscript
    image/gif
    message/rfc822
        multipart/mixed
            audio/basic
            audio/basic
    message/rfc822
        multipart/mixed
            application/postscript
            text/plain
            message/rfc822
                multipart/mixed
                    text/plain
                    multipart/parallel
                        image/gif
                        audio/basic
                    application/atomicmail
                    message/rfc822
                        audio/x-sun
)ZassertEqualZndiffAssertEqualr   Zget_payloadtypelistlenZpreambleZepiloguer   r   getvalue)r   eqZneqr   payloadr   r   r   r   test_mondo_message/   s    
z%TestCrispinTorture.test_mondo_messageN)r   r   r   r)   r   r   r   r   r    -   s   r    c                      s    t jt   fddt D S )Nc                    s    g | ]}| d rt |qS )ZTest)
startswithgetattr).0namemodr   r   
<listcomp>u       z _testclasses.<locals>.<listcomp>)sysmodulesr   dirr   r   r.   r   _testclassess   s    
r5   c                  C   s(   t  } t D ]}| t | q| S r   )unittestZ	TestSuiter5   ZaddTestZ	makeSuite)suite	testclassr   r   r   r7   x   s    
r7   c                  C   s   t  D ]} t|  qd S r   )r5   r   )r8   r   r   r   	test_main   s    
r9   __main__)ZdefaultTest)r2   r   r6   ior   Ztest.test_emailr   Ztest.supportr   r   r   r   Zemail.iteratorsr   r   OSErrorZSkipTestr   r    r5   r7   r9   r   mainr   r   r   r   <module>	   s(   F