HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/test_email/__pycache__/__init__.cpython-37.pyc
B

��g��@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
�4/usr/local/lib/python3.7/test/test_email/__init__.py�
load_testssrcOs(tj�tj�t�d|�}t|f|�|�S)N�data)rr�joinr�landmark�open)�filenamer	Zkwsrr
r
r�openfilesrcsleZdZdZeZeZ�fdd�Ze	j
jZdd�Z
ddd�Zddd	�Zd
d�Zdd
�Zdd�Zdd�Z�ZS)�
TestEmailBaseNcs t�j||�|�t|j�dS)N)�super�__init__ZaddTypeEqualityFunc�bytes�assertBytesEqual)�selfr	�kw)�	__class__r
rr!szTestEmailBase.__init__c	Cs$t|��}tj||jd�SQRXdS)N)�policy)r�emailZmessage_from_filer)rr�fpr
r
r�_msgobj(s
zTestEmailBase._msgobjcCs,|dkr|j}|dkr|j}tj|||d�S)N)r)r�messagerZmessage_from_string)r�stringrrr
r
r�_str_msg,s
zTestEmailBase._str_msgcCs,|dkr|j}|dkr|j}tj|||d�S)N)r)rrrZmessage_from_bytes)rZ
bytestringrrr
r
r�
_bytes_msg3s
zTestEmailBase._bytes_msgcCs|j|jd�S)N)r)rr)rr
r
r�
_make_message:szTestEmailBase._make_messagecCsdd�|jdd�D�S)NcSsg|]}t|��qSr
)�repr)�.0�xr
r
r�
<listcomp>>sz-TestEmailBase._bytes_repr.<locals>.<listcomp>T)�keepends)�
splitlines)r�br
r
r�_bytes_repr=szTestEmailBase._bytes_reprcCs|�|�|�|�|��dS)z@Our byte strings are really encoded strings; improve diff outputN)�assertEqualr+)r�first�second�msgr
r
rr@szTestEmailBase.assertBytesEqualcCsL|�t|�t|�|�x0tt|��D] }|�||||d�|��q$WdS)Nzitem {})r,�len�rangeZassertIsInstance�format)r�actualZexpected�ir
r
r�assertDefectsEqualDsz TestEmailBase.assertDefectsEqual)NN)NN)�__name__�
__module__�__qualname__ZmaxDiffrrrrr�unittest�TestCaser,ZndiffAssertEqualrr!r"r#r+rr5�
__classcell__r
r
)rrrs

rcCs�i}t�t�}x�|j��D]�\}}|�d�r�t|d�s�i}x@|D]8}t|d�sT|f}d�dd�|D���dd�}|||<q@W|}|||dd	�d
<d
|kr||�	d
�dd
�
|�qWi}x"|D]}||kr�td�|���q�Wx"|D]}||kr�td
�|���q�Wx�|j��D]�\}}x�|��D]�\}	}
|�
|	��r&d|t|	�d�}xZ|
��D]N\}}
t|
d��r|||
fdd�}n||
fdd�}|d|}||_|||<�qXW�q&W�qWx"|��D]\}}t|||��q�W|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|�VqdS)N)�str)r%�vr
r
r�	<genexpr>�szparameterize.<locals>.<genexpr>� Ni����Z_as_rzNo tester found for {}zNo params found for {}Ztest_cSst||�f|�S)N)�getattr)r�name�paramsr
r
r�<lambda>�szparameterize.<locals>.<lambda>cSst||�|�S)N)rC)rrDrEr
r
rrF�s)�collections�defaultdict�list�__dict__�items�endswith�hasattrr�replace�split�append�
ValueErrorr2�
startswithr0r6�setattr)�clsZ
paramdictsZtestersrD�attr�dr&�nZ	testfuncsZ
paramsnameZ
paramsdictZtestnamerootZ	paramnamerEZtestZtestname�key�valuer
r
r�parameterizeKsH5




 

rZ)rr9rGrZ
email.messagerZemail._policybaserZtest.supportrZtest.test_emailrrrrr:rrZr
r
r
r�<module>s4