Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/test_email/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/test_email/__pycache__/__init__.cpython-310.pyc

o

0�i��@s~ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZdd�Z
dd	�ZGd
d�dej�Zdd
�ZdS)�N)�Message)�compat32)�load_package_tests)�__file__cGsttj�t�g|�R�S�N)r�os�path�dirnamer)�args�r�?/opt/alt/python310/lib64/python3.10/test/test_email/__init__.py�
load_testssr
cOs.tj�tj�t�d|�}t|g|�Ri|��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|i|��|�t|j�dSr)�super�__init__ZaddTypeEqualityFunc�bytes�assertBytesEqual)�selfr
�kw��	__class__rrr!szTestEmailBase.__init__cCs@t|dd��}tj||jd�Wd�S1swYdS)Nzutf-8)�encoding��policy)r�emailZmessage_from_filer)rr�fprrr�_msgobj(s$�zTestEmailBase._msgobjcC�,|dur|j}|dur|j}tj|||d�S�Nr)r�messager Zmessage_from_string)r�stringr%rrrr�_str_msg,�
zTestEmailBase._str_msgcCr#r$)rr%r Zmessage_from_bytes)rZ
bytestringr%rrrr�
_bytes_msg3r(zTestEmailBase._bytes_msgcCs|j|jd�Sr$)r%r)rrrr�
_make_message:�zTestEmailBase._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)�assertEqualr3)r�first�second�msgrrrr@szTestEmailBase.assertBytesEqualcCsH|�t|�t|�|�tt|��D]}|�||||d�|��qdS)Nzitem {})r4�len�rangeZassertIsInstance�format)rZactualZexpected�irrr�assertDefectsEqualDs��z TestEmailBase.assertDefectsEqual)NN)�__name__�
__module__�__qualname__ZmaxDiffrrrr%r�unittest�TestCaser4ZndiffAssertEqualr"r'r)r*r3rr<�
__classcell__rrrrrs

rcCs�i}t�t�}|j��D]M\}}|�d�rGt|d�s=i}|D]}t|d�s(|f}d�dd�|D���dd�}|||<q|}|||dd	�d
<d
|vrY||�	d
�dd
�
|�qi}|D]
}||vrktd�|���q^|D]
}||vr{td
�|���qn|j��D]F\}}|��D]=\}	}
|�
|	�r�d|t|	�d�}|
��D]%\}}
t|
d�r�||
fdd�}n||
fdd�}|d|}||_|||<q�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>�s�zparameterize.<locals>.<genexpr>� Ni����Z_as_rzNo tester found for {}zNo params found for {}Ztest_cSst||�di|��S)Nr��getattr�r�name�paramsrrr�<lambda>�szparameterize.<locals>.<lambda>cSst||�|�SrrJrLrrrrO�r+)�collections�defaultdict�list�__dict__�items�endswith�hasattrr�replace�split�append�
ValueErrorr:�
startswithr8r=�setattr)�clsZ
paramdictsZtestersrM�attr�dr.�nZ	testfuncsZ
paramsnameZ
paramsdictZtestnamerootZ	paramnamerN�testZtestname�key�valuerrr�parameterizeKsR5




���


��
rd)rr@rPr Z
email.messagerZemail._policybaserZtest.supportrZtest.test_emailrrr
rrArrdrrrr�<module>s4