Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib64/python3.8/test/test_email/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/test/test_email/__pycache__/__init__.cpython-38.pyc

U

i�f��@s~ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZdd�Z
dd	�ZGd
d�dej�Zdd
�ZdS)�N)�Message)�compat32)�load_package_tests)�__file__cGsttj�t�f|��S�N)r�os�path�dirnamer)�args�r�=/opt/alt/python38/lib64/python3.8/test/test_email/__init__.py�
load_testssr
cOs(tj�tj�t�d|�}t|f|�|�S)N�data)rr�joinr	�landmark�open)�filenamer
Zkwsrrrr�openfilesrcsleZdZdZeZeZ�fdd�Ze	j
jZdd�Z
ddd�Zddd	�Zd
d�Zdd
�Zdd�Zdd�Z�ZS)�
TestEmailBaseNcs t�j||�|�t|j�dSr)�super�__init__ZaddTypeEqualityFunc�bytes�assertBytesEqual)�selfr
�kw��	__class__rrr!szTestEmailBase.__init__c
Cs0t|��}tj||jd�W5QR�SQRXdS�N)�policy)r�emailZmessage_from_filer)rr�fprrr�_msgobj(s
zTestEmailBase._msgobjcCs,|dkr|j}|dkr|j}tj|||d�Sr)r�messagerZmessage_from_string)r�stringr"rrrr�_str_msg,s
zTestEmailBase._str_msgcCs,|dkr|j}|dkr|j}tj|||d�Sr)rr"rZmessage_from_bytes)rZ
bytestringr"rrrr�
_bytes_msg3s
zTestEmailBase._bytes_msgcCs|j|jd�Sr)r"r)rrrr�
_make_message:szTestEmailBase._make_messagecCsdd�|jdd�D�S)NcSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>>sz-TestEmailBase._bytes_repr.<locals>.<listcomp>T)�keepends)�
splitlines)r�brrr�_bytes_repr=szTestEmailBase._bytes_reprcCs|�|�|�|�|��dS)z@Our byte strings are really encoded strings; improve diff outputN)�assertEqualr.)r�first�second�msgrrrr@szTestEmailBase.assertBytesEqualcCsH|�t|�t|�|�tt|��D] }|�||||d�|��q"dS)Nzitem {})r/�len�rangeZassertIsInstance�format)rZactualZexpected�irrr�assertDefectsEqualDs
�z TestEmailBase.assertDefectsEqual)NN)NN)�__name__�
__module__�__qualname__ZmaxDiffrrrr"r�unittest�TestCaser/ZndiffAssertEqualr!r$r%r&r.rr7�
__classcell__rrrrrs

rcCs�i}t�t�}|j��D]�\}}|�d�r�t|d�szi}|D]8}t|d�sP|f}d�dd�|D���dd�}|||<q<|}|||dd	�d
<d
|kr||�	d
�dd
�
|�qi}|D]}||kr�td�|���q�|D]}||kr�td
�|���q�|j��D]�\}}|��D]�\}	}
|�
|	��rd|t|	�d�}|
��D]N\}}
t|
d��rf||
fdd�}n||
fdd�}|d|}||_|||<�qB�q�q|��D]\}}t|||��q�|S)a2A test method parameterization class decorator.

    Parameters are specified as the value of a class attribute that ends with
    the string '_params'.  Call the portion before '_params' the prefix.  Then
    a method to be parameterized must have the same prefix, the string
    '_as_', and an arbitrary suffix.

    The value of the _params attribute may be either a dictionary or a list.
    The values in the dictionary and the elements of the list may either be
    single values, or a list.  If single values, they are turned into single
    element tuples.  However derived, the resulting sequence is passed via
    *args to the parameterized test function.

    In a _params dictionary, the keys become part of the name of the generated
    tests.  In a _params list, the values in the list are converted into a
    string by joining the string values of the elements of the tuple by '_' and
    converting any blanks into '_'s, and this become part of the name.
    The  full name of a generated test is a 'test_' prefix, the portion of the
    test function name after the  '_as_' separator, plus an '_', plus the name
    derived as explained above.

    For example, if we have:

        count_params = range(2)

        def count_as_foo_arg(self, foo):
            self.assertEqual(foo+1, myfunc(foo))

    we will get parameterized test methods named:
        test_foo_arg_0
        test_foo_arg_1
        test_foo_arg_2

    Or we could have:

        example_params = {'foo': ('bar', 1), 'bing': ('bang', 2)}

        def example_as_myfunc_input(self, name, count):
            self.assertEqual(name+str(count), myfunc(name, count))

    and get:
        test_myfunc_input_foo
        test_myfunc_input_bing

    Note: if and only if the generated test name is a valid identifier can it
    be used to select the test individually from the unittest command line.

    The values in the params dict can be a single value, a tuple, or a
    dict.  If a single value of a tuple, it is passed to the test function
    as positional arguments.  If a dict, it is a passed via **kw.

    Z_params�keys�__iter__�_css|]}t|�VqdSr)�str)r(�vrrr�	<genexpr>�szparameterize.<locals>.<genexpr>� Ni����Z_as_rzNo tester found for {}zNo params found for {}Ztest_cSst||�f|�Sr��getattr�r�name�paramsrrr�<lambda>�szparameterize.<locals>.<lambda>cSst||�|�SrrErGrrrrJ�s)�collections�defaultdict�list�__dict__�items�endswith�hasattrr�replace�split�append�
ValueErrorr5�
startswithr3r8�setattr)�clsZ
paramdictsZtestersrH�attr�dr)�nZ	testfuncsZ
paramsnameZ
paramsdictZtestnamerootZ	paramnamerIZtestZtestname�key�valuerrr�parameterizeKsH5




r^)rr;rKrZ
email.messagerZemail._policybaserZtest.supportrZtest.test_emailrrr
rr<rr^rrrr�<module>s4