%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/unittest/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/unittest/__pycache__/loader.cpython-312.pyc

�

���fR���dZddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZdZ
ejdej�ZGd�d	e
j"�Zd
�Zd�Zd�Zd
�Zd�ZGd�de�Ze�Zdd�Zej8dfd�Zdej8ej<fd�Zdej8ej<fd�Z y)zLoading unittests.�N)�fnmatch�fnmatchcase�)�case�suite�utilTz[_a-z]\w*\.py$c�,��eZdZdZ�fd�Z�fd�Z�xZS)�_FailedTestNc�:��||_tt|�|�y�N)�
_exception�superr
�__init__)�self�method_name�	exception�	__class__s   ��&/usr/lib/python3.12/unittest/loader.pyrz_FailedTest.__init__s���#���
�k�4�)�+�6�c�X���|�jk7rtt��|�S�fd�}|S)Nc����j�r)r
�rs�r�testFailurez,_FailedTest.__getattr__.<locals>.testFailure s
����/�/�!r)�_testMethodNamerr
�__getattr__)r�namerrs`  �rrz_FailedTest.__getattr__s.����4�'�'�'���d�7��=�=�	"��r)�__name__�
__module__�__qualname__rrr�
__classcell__�rs@rr
r
s����O�7��rr
c�d�d|�dtj���}t|t|�||�S)NzFailed to import test module: �
)�	traceback�
format_exc�_make_failed_test�ImportError)r�
suiteClass�messages   r�_make_failed_import_testr*%s-���i�"�"�$�&�G��T�;�w�#7��W�M�Mrc�L�dtj���}t||||�S)NzFailed to call load_tests:
)r$r%r&)rrr(r)s    r�_make_failed_load_testsr,*s)��2;�2F�2F�2H�J�G���i��W�.�.rc�0�t||�}||f�|fSr)r
)�
methodnamerr(r)�tests     rr&r&/s ���z�9�-�D��t�g���'�'rc��tjt|��d��}||i}tdtjf|�}|||�f�S)Nc��yr�rs r�testSkippedz'_make_skipped_test.<locals>.testSkipped4s��r�
ModuleSkipped)r�skip�str�type�TestCase)r.rr(r3�attrs�	TestClasss      r�_make_skipped_testr;3sS��	�Y�Y�s�9�~��
��
�
��%�E��_�t�}�}�&6��>�I��y��,�.�/�/rc�F�tjj|�dS)Nr)�os�path�splitext)r>s r�	_splitextr@;s��
�7�7���D�!�!�$�$rc���eZdZdZdZeej�ZdZ	e
jZdZ
�fd�Zd�Zdd�d�Zdd�Zdd	�Zd
�Zdd�Zd�Zd
�Zd�Zd�Zd�Zd�Z�xZS)�
TestLoaderz�
    This class is responsible for loading tests according to various criteria
    and returning them wrapped in a TestSuite
    r/Nc�V��tt|��g|_t	�|_yr)rrBr�errors�set�_loading_packages)rrs �rrzTestLoader.__init__Js#���
�j�$�(�*����"%���rc��t|tj�rtd��|tj
tjfvrg}n"|j|�}|st|d�rdg}|jt||��}|S)z;Return a suite of all test cases contained in testCaseClasszYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?�runTest)�
issubclassr�	TestSuite�	TypeErrorrr8�FunctionTestCase�getTestCaseNames�hasattrr(�map)r�
testCaseClass�
testCaseNames�loaded_suites    r�loadTestsFromTestCasez TestLoader.loadTestsFromTestCaseQs~���m�U�_�_�5��(�)�
)��T�]�]�D�,A�,A�B�B��M� �1�1�-�@�M� �W�]�I�%F�!*��
����s�=�-�'H�I���r��patternc�$�g}t|�D]}}t||�}t|t�s� t	|t
j�s�;|t
jt
jfvs�^|j|j|���t|dd�}|j|�}|�	||||�S|S#t$rK}t|j||j�\}}	|jj|	�|cYd}~Sd}~wwxYw)z>Return a suite of all test cases contained in the given module�
load_testsN)�dir�getattr�
isinstancer7rIrr8rL�appendrSr(�	Exceptionr,rrD)
r�modulerU�testsr�objrW�e�
error_case�
error_messages
          r�loadTestsFromModulezTestLoader.loadTestsFromModuleas�������K�	>�D��&�$�'�C��3��%��s�D�M�M�2���
�
�t�/D�/D�E�E����T�7�7��<�=�	>��V�\�4�8�
�����&���!�
"�!�$��w�7�7�����
"�,C��O�O�Q����-9�)�
�M����"�"�=�1�!�!��	
"�s�/	B;�;	D�AD
�D�
Dc
���|jd�}d\}}|�*|dd}|r	dj|�}t|�}	|dd}|}	|D]}
	|	t|	|
�}	}�t|	tj �r|j#|	�St|	t$�rMt'|	t(j*�r3|	t(j*t(j,fvr|j/|	�St|	tj0�rmtt$�r]t'|t(j*�rC|d}||�}
tt|
|�tj0�s.|j
|
g�St|	t2j4�r|	St7|	�ra|	�}t|t2j4�r|St|t(j*�r|j
|g�St9d|	�d	|�d
���t9d|	z��#t$rM|j	�}t||j�\}}|s|jj|�|cYSYnwxYw|r��=��!#t$r�}t|	dd��&|�$|jj|�|cYd}~cSt|
||jdtj����\}}|jj|�|cYd}~cSd}~wwxYw)aSReturn a suite of all test cases given a string specifier.

        The name may resolve either to a module, a test case class, a
        test method within a test case class, or a callable object which
        returns a TestCase or TestSuite instance.

        The method optionally resolves the names relative to a given module.
        �.�NNNr�__path__zFailed to access attribute:
���zcalling z
 returned z, not a testz$don't know how to make test from: %s)�split�join�
__import__r'�popr*r(rDr[rY�AttributeErrorr&r$r%rZ�types�
ModuleTypercr7rIrr8rLrS�FunctionTyperrJ�callablerK)rrr]�partsrarb�
parts_copy�module_name�next_attributer_�part�parentr`�instr/s               r�loadTestsFromNamezTestLoader.loadTestsFromNameys����
�
�3���$.�!�
�M��>��q��J��*�"%�(�(�:�"6�K�'��4�F���!�"�I�E����	&�D�
&�!�7�3��#5���	&�.�c�5�+�+�,��+�+�C�0�0��s�D�!��3��
�
�.��D�M�M�4�+@�+@�A�A��-�-�c�2�2���e�0�0�1����&������/���9�D��$�<�D��g�d�D�1�5�3E�3E�F�����v�.�.�
��U�_�_�
-��J��C�=��5�D��$����0����D�$�-�-�0�����v�.�.��!$�d�!,�-�-��B�S�H�I�I��}#�*�%/�^�^�%5�N�0H�&����19�-�J�
�%����*�*�=�9�)�)�&�*����&"�
&��C��T�2�>�"�.��K�K�&�&�}�5�%�%�1B��a����%�0�0�2�5�16�-�J�
��K�K�&�&�}�5�%�%��%
&�s=�H�I�AI�I�	K4�(+K/�K4�AK/�'K4�/K4c�l�|D�cgc]}|j||���}}|j|�Scc}w)z�Return a suite of all test cases found using the given sequence
        of string specifiers. See 'loadTestsFromName()'.
        )ryr()r�namesr]r�suitess     r�loadTestsFromNameszTestLoader.loadTestsFromNames�s;��DI�I�4�$�(�(��v�6�I��I����v�&�&��Js�1c�������fd�}tt|t����}�jr/|j	tj�j���|S)zLReturn a sorted sequence of method names found within testCaseClass
        c����|j�j�syt�|�}t|�syd�j�j
|fz��jduxst�fd��jD��S)NFz%s.%s.%sc3�6�K�|]}t�|����y�wr)r)�.0rU�fullNames  �r�	<genexpr>zKTestLoader.getTestCaseNames.<locals>.shouldIncludeMethod.<locals>.<genexpr>�s�����X�w�K��'�2�X�s�)�
startswith�testMethodPrefixrYrqrr�testNamePatterns�any)�attrname�testFuncr�rrPs  @��r�shouldIncludeMethodz8TestLoader.getTestCaseNames.<locals>.shouldIncludeMethod�s�����&�&�t�'<�'<�=���}�h�7�H��H�%��!��(�(�-�*D�*D�h�&��H��(�(�D�0�Y��X�$�BW�BW�X�X�
Yr)�key)�list�filterrX�sortTestMethodsUsing�sort�	functools�
cmp_to_key)rrPr��testFnNamess``  rrMzTestLoader.getTestCaseNames�sS���
	Y��6�"5�s�=�7I�J�K���$�$�����!5�!5�d�6O�6O�!P��Q��rc��d}|�|j�
|j}n|�d}|}tjj|�}|tjvr tjjd|�||_d}tjj
tjj|��rctjj|�}||k7r�tjjtjj|d��}n�	t|�tj|}|jd�d}	tjjtjj|j��}|r6|j%|�|_tjj'|�	|rt)d	|z��t+|j-||��}|j/|�S#t$r8|jtj vrt#d�d�t#d|���d�wxYw#t($rd}Y��wxYw)
a%Find and return all test modules from the specified start
        directory, recursing into subdirectories to find them and return all
        tests found within them. Only test files that match the pattern will
        be loaded. (Using shell style pattern matching.)

        All test modules must be importable from the top level of the project.
        If the start directory is not the top level directory then the top
        level directory must be specified separately.

        If a test package name (directory with '__init__.py') matches the
        pattern then the package will be checked for a 'load_tests' function. If
        this exists then it will be called with (loader, tests, pattern) unless
        the package has already had load_tests called from the same discovery
        invocation, in which case the package module object is not scanned for
        tests - this ensures that when a package uses discover to further
        discover child tests that infinite recursion does not happen.

        If load_tests exists then discovery does *not* recurse into the package,
        load_tests is responsible for loading all tests in the package.

        The pattern is deliberately not stored as a loader attribute so that
        packages can continue discovery themselves. top_level_dir is stored so
        load_tests does not need to pass this argument in to loader.discover().

        Paths are sorted before being imported to ensure reproducible execution
        order even on filesystems with non-alphabetical ordering like ext3/4.
        FNTr�__init__.pyrez2Can not use builtin modules as dotted module namesz don't know how to discover from z%Start directory is not importable: %r)�_top_level_dirr=r>�abspath�sys�insert�isdir�isfilerjrk�modulesri�dirname�__file__rmr�builtin_module_namesrK� _get_directory_containing_module�remover'r��_find_testsr()	r�	start_dirrU�
top_level_dir�set_implicit_top�is_not_importable�
the_module�top_partr^s	         r�discoverzTestLoader.discover�s��8!��� �T�%8�%8�%D� �/�/�M�
�
"�#��%�M������
�6�
�����(�

�H�H�O�O�A�}�-�+���!��
�7�7�=�=�������3�4������	�2�I��M�)�(*�����r�w�w�|�|�I�}�7]�(^�$^�!�
3��9�%�!�[�[��3�
�$�?�?�3�/��2��(� "�����������)<�)<�>�!@�I�$�*.�*O�*O�PX�*Y�D�'��H�H�O�O�M�2���E�	�Q�R�R��T�%�%�i��9�:�����u�%�%��%&�(�!�*�*�c�.F�.F�F�'�)A�B�GK�L�(�>�z�n�M��#'�(�
(���
)�$(�!�
)�s �I�AH�AI�I�Ic��tj|}tjj	|j
�}tjj
|�j�jd�r<tjjtjj|��Stjj|�S)Nr�)
r�r�r=r>r�r��basename�lowerr�r�)rrtr]�	full_paths    rr�z+TestLoader._get_directory_containing_module8s������[�)���G�G�O�O�F�O�O�4�	�
�7�7���I�&�,�,�.�9�9�-�H��7�7�?�?�2�7�7�?�?�9�#=�>�>�
�7�7�?�?�9�-�-rc��||jk(ryttjj	|��}tjj||j�}tjj
|�rJd��|jd�rJd��|jtjjd�}|S)NrezPath must be within the projectz..)
r�r@r=r>�normpath�relpath�isabsr��replace�sep)rr>�_relpathrs    r�_get_name_from_pathzTestLoader._get_name_from_pathDs����4�&�&�&������)�)�$�/�0���7�7�?�?�4��)<�)<�=���7�7�=�=��*�M�,M�M�*��&�&�t�,�O�.O�O�,���������S�1���rc�>�t|�tj|Sr)rkr�r�)rrs  r�_get_module_from_namez TestLoader._get_module_from_namePs���4���{�{�4� � rc��t||�Sr)r)rr>r�rUs    r�_match_pathzTestLoader._match_pathTs���t�W�%�%rc#�^K�|j|�}|dk7r,||jvr|j||�\}}|�|��|sytt	j
|��}|D]�}tjj||�}|j||�\}}|�|��|s�A|j|�}|jj|�	|j||�Ed{���|jj|���y7�"#|jj|�wxYw�w)z/Used by discovery. Yields test suites it loads.reN)r�rF�_find_test_path�sortedr=�listdirr>rj�addr��discard)	rr�rUrr^�should_recurse�pathsr>r�s	         rr�zTestLoader._find_testsXs#�����'�'�	�2���3�;�4�t�'=�'=�=�%)�$8�$8��G�$L�!�E�>�� ���!���r�z�z�)�,�-���	9�D������Y��5�I�$(�$8�$8��G�$L�!�E�>�� �����/�/�	�:���&�&�*�*�4�0�9�#�/�/�	�7�C�C�C��*�*�2�2�4�8�	9�D���*�*�2�2�4�8�s6�B#D-�&,D-�D
�(D�)D
�-D-�D
�
D*�*D-c�z�tjj|�}tjj|��rvtj|�sy|j
|||�sy|j|�}	|j|�}tjjt|d|��}ttjj|��}ttjj|��}|j�|j�k7rytjj|�}	ttjj|��}
tjj|�}d}t||
|	|fz��|j!||��dfStjj1|�r�tjjtjj3|d��syd}d}|j|�}	|j|�}t|dd�}|j4j7|�	|j!||��}|�|df|j4j9|�S|d	f|j4j9|�Sy#t"j$$r#}
t'||
|j(�dfcYd}
~
Sd}
~
wt+||j(�\}}|j,j/|�|dfcYSxYw#|j4j9|�wxYw#t"j$$r#}
t'||
|j(�dfcYd}
~
Sd}
~
wt+||j(�\}}|j,j/|�|dfcYSxYw)
z�Used by discovery.

        Loads tests from a single file, or a directories' __init__.py when
        passed the directory.

        Returns a tuple (None_or_tests_from_file, should_recurse).
        )NFr�zW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?rTFNr�rWT)r=r>r�r��VALID_MODULE_NAME�matchr�r�r�r�rYr@�realpathr�r�r'rcr�SkipTestr;r(r*rDr[r�rjrFr�r�)rr�rUr�rr]�mod_filer��fullpath_noext�
module_dir�mod_name�expected_dir�msgr`rarbrWr^�packages                   rr�zTestLoader._find_test_pathxs%���7�7�#�#�I�.��
�7�7�>�>�)�$�$�*�*�8�4�"��#�#�H�i��A�"��+�+�I�6�D�
P��3�3�D�9���7�7�?�?��F�J�	�:�<��$��G�G�$�$�X�.�0��!*��G�G�$�$�Y�/�"1���>�>�#�~�';�';�'=�=�!#������!:�J�(����(�(��3� 5�H�#%�7�7�?�?�9�#=�L�D�C�%��x��\�B�B�D�D��/�/���/�H�%�O�O�
�W�W�]�]�9�
%��7�7�>�>�"�'�'�,�,�y�-�"H�I�"��J��E��+�+�I�6�D�
9��4�4�T�:��%�W�l�D�A�
��&�&�*�*�4�0�9� �4�4�W�g�4�N�E�!�-�$�e�|��*�*�2�2�4�8�!�$�;��*�*�2�2�4�8���k�=�=�
K�)�$��4�?�?�C�U�J�J��
)�,�T�4�?�?�C�*�
�M����"�"�=�1�!�5�(�(��Z�*�*�2�2�4�8��%�=�=�
K�)�$��4�?�?�C�U�J�J��
)�,�T�4�?�?�C�*�
�M����"�"�=�1�!�5�(�(�sN�<J7�)M
�#L*�L*�7L'�
K(�"L'�(=L'�*M�
N:�M;�5N:�;=N:r)ztest*.pyN)rrr�__doc__r��staticmethodr�
three_way_cmpr�r�rrJr(r�rrSrcryr}rMr�r�r�r�r�r�r�r r!s@rrBrB?s�������'��(:�(:�;�������J��N�'�� 6:��0PJ�d'��&Q&�f
.�
�!�&�9�@HrrBc�V�t�}||_||_||_|r||_|Sr)rBr�r�r�r()�prefix�	sortUsingr(r��loaders     r�_makeLoaderr��s1��
�\�F�"+�F��$�F��.�F���&����Mrc�t�ddl}|jdtd��t|||��j	|�S)Nrz�unittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.getTestCaseNames() instead.���
stacklevel)r�)�warnings�warn�DeprecationWarningr�rM)rPr�r�r�r�s     rrMrM�s?����M�M�	E��q���
�v�y�;K�L�]�]�^k�l�lrr/c�r�ddl}|jdtd��t|||�j	|�S)Nrz�unittest.makeSuite() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromTestCase() instead.r�r�)r�r�r�r�rS)rPr�r�r(r�s     r�	makeSuiter��sB����M�M�	J��q���
�v�y�*�5�K�K���rc�r�ddl}|jdtd��t|||�j	|�S)Nrz�unittest.findTestCases() is deprecated and will be removed in Python 3.13. Please use unittest.TestLoader.loadTestsFromModule() instead.r�r�)r�r�r�r�rc)r]r�r�r(r�s     r�
findTestCasesr��sB����M�M�	H��q���
�v�y�*�5�I�I���rrf)!r�r=�rer�r$rnr�rr�rrr�
__unittest�compile�
IGNORECASEr�r8r
r*r,r&r;r@�objectrB�defaultTestLoaderr�r�rMrJr�r�r2rr�<module>r�s����	�	�
����(���
�
�
�B�J�J�0�"�-�-�@���$�-�-��N�
.�
(�0�%�A��A�H�L���7;�6H�6H�[_�m�%+�d�6H�6H����	�"(�4�3E�3E�"�_�_�	r

Zerion Mini Shell 1.0