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.10/test/test_email/__pycache__/__init__.cpython-310.pyc
o

�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�5/usr/local/lib/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
�kwsrrrr�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&r rrr�_str_msg,�
zTestEmailBase._str_msgcCr$r%)r r&r!Zmessage_from_bytes)rZ
bytestringr&r rrr�
_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)�assertEqualr4)r�first�second�msgrrrr@szTestEmailBase.assertBytesEqualcCsH|�t|�t|�|�tt|��D]}|�||||d�|��qdS)Nzitem {})r5�len�rangeZassertIsInstance�format)r�actualZexpected�irrr�assertDefectsEqualDs��z TestEmailBase.assertDefectsEqual)NN)�__name__�
__module__�__qualname__ZmaxDiffrr rr&r�unittest�TestCaser5ZndiffAssertEqualr#r(r*r+r4rr>�
__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||�|�SrrLrNrrrrQ�r,)�collections�defaultdict�list�__dict__�items�endswith�hasattrr�replace�split�append�
ValueErrorr;�
startswithr9r?�setattr)�clsZ
paramdictsZtestersrO�attr�dr/�nZ	testfuncsZ
paramsnameZ
paramsdictZtestnamerootZ	paramnamerP�testZtestname�key�valuerrr�parameterizeKsR5




���


��
rf)rrBrRr!Z
email.messagerZemail._policybaserZtest.supportrZtest.test_emailrrr
rrCrrfrrrr�<module>s4