PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/loader.cpython-312.pyc

�

���g�c��*�dZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlmZmZmZdd	lmZmZdd
lmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'ddlm(Z(m)Z)ddl*Z*ejVe,�Z-ej\j^Z0ej\jbZ2ej\jfZ4ej\jjZ6ej\jnZ8d
dgZ9Gd�d
ejt�Z:e:Z;y)z�
Test Loader
-----------

nose's test loader implements the same basic functionality as its
superclass, unittest.TestLoader, but extends it by more liberal
interpretations of what may be a test and how a test may be named.
�N)�
isfunction)�unbound_method�ismethod)�FunctionTestCase�MethodTestCase)�Failure)�Config)�Importer�add_path�remove_path)�defaultSelector�TestAddress)
�func_lineno�
getpackage�isclass�isgenerator�	ispackage�regex_last_key�resolve_name�transplant_func�transplant_class�test_address)�ContextSuiteFactory�ContextList�	LazySuite)�	sort_list�
cmp_to_key�
TestLoader�defaultTestLoaderc���eZdZdZdZdZdZdZdZ		dd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zdd�Zdd�Zdd
�Z�fd�Zd�Zdd�Zdd�Zd�Zd�Z�xZS)raATest loader that extends unittest.TestLoader to:

    * Load tests from test-like functions and classes that are not
      unittest.TestCase subclasses
    * Find and load test modules in a directory
    * Support tests that are generators
    * Support easy extensions of or changes to that behavior through plugins
    Nc��|�
t�}|�t|��}|�|j}|�t|�}nt	|�r||�}||_||_tt|��|_||_	|jrt||�t|��|_
tg�|_t j"j%|�y)aInitialize a test loader.

        Parameters (all optional):

        * config: provide a `nose.config.Config`_ or other config class
          instance; if not provided a `nose.config.Config`_ with
          default values is used.
        * importer: provide an importer instance that implements
          `importFromPath`. If not provided, a
          `nose.importer.Importer`_ is used.
        * workingDir: the directory to which file and module names are
          relative. If not provided, assumed to be the current working
          directory.
        * selector: a selector class or instance. If a class is
          provided, it will be instantiated with one argument, the
          current config. If not provided, a `nose.selector.Selector`_
          is used.
        N)�config)r	r
�
workingDirr
rr"�importer�op_normpath�
op_abspath�selector�addPathsrr�
suiteClass�set�
_visitedPaths�unittestr�__init__)�selfr"r$r#r's     �:/opt/hc_python/lib/python3.12/site-packages/nose/loader.pyr-zTestLoader.__init__<s���(�>��X�F����v�.�H����*�*�J���&�v�.�H�
�X�
���'�H���� ��
�%�j��&<�=��� ��
��?�?��Z��(�-�V�<��� ��W������$�$�T�*�c�F�|jjr tjj	||�S||j
fd�}t
t|t|���}|st|d�rdg}|jrt|t|j��|S)z_Override to select with selector, unless
        config.getTestCaseNamesCompat is True
        c��t||d�}t|�r
t||�}nt|�sy|j	|�S�NF��getattrrrr�
wantMethod��attr�cls�sel�items    r/�wantedz+TestLoader.getTestCaseNames.<locals>.wantedm�=���3��d�+�D��$��%�c�4�0���d�^���>�>�$�'�'r0�runTest)
r"�getTestCaseNamesCompatr,r�getTestCaseNamesr'�list�filter�dir�hasattr�sortTestMethodsUsingrr)r.�
testCaseClassr<�casess    r/r@zTestLoader.getTestCaseNamesfs����;�;�-�-��&�&�7�7��m�L�L�*��
�
�	(��V�F�C�
�$6�7�8�����	�:��K�E��$�$��e�Z��(A�(A�B�C��r0c�$�|�y||jvSr3)r+�r.�paths  r/�_haveVisitedzTestLoader._haveVisited~s���<���t�)�)�)�)r0c�@�|�|jj|�yy�N)r+�addrIs  r/�_addVisitedPathzTestLoader._addVisitedPath�s!�������"�"�4�(�r0c#�~��
K�tjd|��jj}|j	|��jj
rt
|�j�}tj|�}t|t�jj��|D�]P}|jd�r�tt||���
t�
�}d}|rd}�j j#�
�}n:t%�
�}|r-|jd�r�w�j j'�
�}t)�
�}	|s���j+�
�r���j-�
�|r\|j/�|j1d�r�j3�
d����n�j5�
���|j7���!|	r�j3�
d������:�j9�
�fd������Sg}
|j;|�D]}|
j=|��	|
r�j9|
����jj
rD]
}tI|��|jK|�y	#t>t@f$r��j9tCtEjF��g���Y�yxYw�w)
z�Load tests from the directory at path. This is a generator
        -- each suite of tests from a module or other file is yielded
        and is expected to be executed before the next file is
        examined.
        zload from dir %s�.F�_z.pyT��
discoveredc�&���j��SrM��loadTestsFromDir)�
entry_pathr.s��r/�<lambda>z-TestLoader.loadTestsFromDir.<locals>.<lambda>�s���� 5� 5�j� Ar0N)&�log�debugr"�plugins�beforeDirectoryr(r�os�listdirrr�	testMatch�
startswithr&�op_join�	op_isfiler'�wantFile�op_isdir�
wantDirectoryrrKrO�
beforeContext�endswith�loadTestsFromName�loadTestsFromFile�afterContextr)rW�append�KeyboardInterrupt�
SystemExitr�sys�exc_infor�afterDirectory)r.rJr\�paths_added�entries�entry�is_filer<�is_dir�
is_package�tests�test�prXs`            @r/rWzTestLoader.loadTestsFromDir�se�����	�	�	�$�d�+��+�+�%�%������%��;�;���"�4����5�K��*�*�T�"���'�>�$�+�+�*?�*?�@�A��E�����$��#�G�D�%�$8�9�J��
�+�G��F�������/�/�
�;��!�*�-����'�'��,� �!�]�]�8�8��D�F�"�:�.�J��d�/�/�
�;��$�$�Z�0���)�)�+��~�~�e�,�"�4�4�&�4�5�9�9�#�4�4�Z�@�@��(�(�*���0�0�"�t�1�5�5��/�/�A�C�C�W�Z���,�,�T�2�D��L�L���3�	>���o�o�e�,�,��;�;��� ���!�n�!����t�$��"�:�.�	��	>��/�/�7�C�L�L�N�#;�"<�=�=�s+�E	J=�J=� CJ=�,I;�:J=�;=J:�8J=c���tjd|�	|jjj	|�D�cgc]}|��}}|r#|D�cgc]}|s�|��	}}|j|�St
|d�j�td|z��cc}wcc}w#ttf$r�tj�}|jt|d|d|d|ddf��g�cYSxYw)	z�Load tests from a non-module file. Default is to raise a
        ValueError; plugins may implement `loadTestsFromFile` to
        provide a list of tests loaded from the file.
        zLoad from non-module file %s�rz!Unable to load tests from file %sr��N��address)rZr[r"r\rjr)�open�close�
ValueErrorrmrnrorpr)r.�filenameryrx�_f�excs      r/rjzTestLoader.loadTestsFromFile�s��
	�	�	�0�(�;�	;��[�[�(�(�:�:�8�D�F�D�#�T�D�
�F��',�2�e��r��e��2����u�-�-��X�s�#�)�)�+� �!D�#+�",�-�-��F��3��"�:�.�	��	;��,�,�.�C��?�?���Q���Q���Q��"*�D�$�!7�9�:�;�
;�s/�'B!�	B�B!�B�B�B!�/2B!�!AC3c�@����|f��fd�	}�j|�d��S)z�Lazy-load tests from a generator function. The generator function
        may yield either:

        * a callable, or
        * a function name resolvable within the same module
        c	3�J�K�	|�D]L}�j|�\}}t|tj�st	||�}t|||�����Ny#t$r�tj�}t|d|d|dt������YyxYw�w)N��arg�
descriptorrr}r~r)�parseGeneratedTest�
isinstance�collections�Callabler5rrmrorprr)�g�mry�	test_funcr�r��	generatorr.s      ��r/�generatez3TestLoader.loadTestsFromGenerator.<locals>.generate�s������
?��C�D�%)�%<�%<�T�%B�N�I�s�%�i��1E�1E�F�$+�A�y�$9�	�*�9�#�!�L�L�	 ��
%�
��
?��l�l�n���c�!�f�c�!�f�c�!�f�&2�9�&=�?�?�s�B#�AA�B#�AB �B#F��context�	can_split)r))r.r��moduler�s``  r/�loadTestsFromGeneratorz!TestLoader.loadTestsFromGenerator�s&���!�F�	?����x��e��L�Lr0c�����t�d�r�jj}|�}�j}t	||���|f��fd�	}�j|�d��S)z�Lazy-load tests from a generator method.

        This is more complicated than loading from a generator function,
        since a generator method may yield:

        * a function
        * a bound or unbound method, or
        * a method name
        �im_classc	3��K�	|�D]�}�j|�\}}t|tj�st	|t||��}t
|�rt|||�����ct|tj�rt|||������ttd|z�����y#t$r�tj�}t|d|d|dt������YyxYw�w)Nr�)ryr�z%s is not a callable or methodrr}r~r)r�r�r�r�rr5rrr�	TypeErrorrmrorpr)r��cryr�r�r�r�r.s      ��r/r�z9TestLoader.loadTestsFromGeneratorMethod.<locals>.generates������
?��C�D�%)�%<�%<�T�%B�N�I�s�%�i��1E�1E�F�$2�1�g�a��6K�$L�	��	�*�,�Y�C�A�N�N�#�I�{�/C�/C�D�
-�Q�Y�C�H�H�%�%�<�y�H�J�J� �� %�
��
?��l�l�n���c�!�f�c�!�f�c�!�f�&2�9�&=�?�?�s�C9�B,B2�1C9�2AC6�4C9Fr�)rD�__self__�	__class__�__name__r5r))r.r�r9�inst�methodr�s``    r/�loadTestsFromGeneratorMethodz'TestLoader.loadTestsFromGeneratorMethod	s_����9�j�)��$�$�.�.�C��u���#�#���D�&�)�	� �C�	?�0���x��e��L�Lr0c���tjd|�g}g}g}|r|jj|�r�t	|�D]�}t||d�}t
|�r.|jj|�s�7|j|��It|�s�U|jj|�s�q|j|���t|d��t|t�||zD�	cgc]}	|j|	|����}}	t|dg�}
|r<tjj!tjj#|��}|
D�]-}tjd|�tjd|tjj!|�tjj#tjj!|���|j$j&sN|rLtjj#tjj!|��j)|�s��tjj+|�s��|j-|j/|����0|j$j0j3||�D]}|j|��|j5t7||���Scc}	w)	z�Load all tests from module and return a suite containing
        them. If the module has been discovered and is not test-like,
        the suite will be empty by default, though plugins may add
        their own tests.
        zLoad from module %sNc��|jSrM)r�)�xs r/rYz0TestLoader.loadTestsFromModule.<locals>.<lambda>Ks��a�j�jr0)�parent�__path__zLoad tests from module path %s?z!path: %s os.path.realpath(%s): %s�r�)rZr[r'�
wantModulerCr5r�	wantClassrlr�wantFunctionrr�makeTestr^rJ�normcase�realpathr"�traverseNamespacera�isdir�extendrWr\�loadTestsFromModuler)r)r.r�rJrTrx�test_classes�
test_funcsr;ry�t�module_paths�module_paths            r/r�zTestLoader.loadTestsFromModule5s1��	�	�	�'��0������
��T�]�]�5�5�f�=��F����v�t�T�2���4�=��}�}�.�.�t�4�$�+�+�D�1���%�$�-�-�*D�*D�T�*J��%�%�d�+�$�
�l�$8�9��j�+�.�>J�Z�>W�X�>W��T�]�]�1�V�]�4�>W�E�X�
�v�z�2�6����7�7�#�#�B�G�G�$4�$4�T�$:�;�D�'�K��I�I�7��E��I�I�9��B�G�G�,�,�[�9��g�g�&�&�r�w�w�'7�'7��'D�E�
G����-�-�T��G�G�$�$����(�(��5�7�7A�z�$�7G�H��7�7�=�=��-��L�L��!6�!6�{�!C�D�(��K�K�'�'�;�;�F�D�I�D��L�L���J����{�5�&�A�B�B��5Ys�-Kc
�&���tjd||��j}�jjj||�}|r||�St
|�j��}|r�|jr|j}�j||�\}}t|�rVt|dd�|jk7r<t|t�s,t||j�}t||j�}tjd|||�t|t�r	||g�S|t!�j#||�g|���S|j$�r	|j&�t)|j$�}n��jjj+|j&|j$�	�j,j/|j&|j$�}�jjj1|j&|j$�|jr�j|j|�S�j=||j&|��S|j&r�|j&�|jrbt?��}
|
�8|tt@d|j�d
��d�|j;��
�g�S�j|j|
��StC��rtE��fd��StG��r�jI��S|ttJd�z|j;��
�g�S|tt@d|z|j;��
�g�S#�jjj1|j&|j$�wxYw#t2t4f$r�t7j8�}	|t|	d|	d|	d	|j;��
�g�cYSxYw)z�Load tests from the entity with the given name.

        The name may indicate a file, directory, module, or any object
        within a module. See `nose.util.split_test_name` for details on
        test name parsing.
        zload from %s (%s))r#�
__module__Nzparent %s obj %s module %sr�rr}r~rrSzCan't find callable z	 in file z: file is not a python module)r�c�&���j��SrMrV)rJr.s��r/rYz.TestLoader.loadTestsFromName.<locals>.<lambda>�s���D�$9�$9�$�$?r0zNo such file %szUnresolvable test name %s)&rZr[r)r"r\rirr#�call�resolverr5r�r�rrrr�r�r�r�beforeImportr$�importFromPath�afterImportrmrnrorp�totupler�rr�rerrcrj�OSError)r.�namer�rT�suite�
plug_tests�addrr��objr��packagerJs`          @r/rizTestLoader.loadTestsFromNameis����	�	�	�%�t�V�4������[�[�(�(�:�:�4��H�
����$�$��4�D�O�O�<����y�y��y�y���,�,�t�V�4�K�F�C�����F�L�$�7�6�?�?�J�"�3��0�)�&�&�/�/�B���f�c�l�l�3���I�I�2�F�C��H��#�w�'��c�U�|�#��[�$�-�-��V�*D�)E�17�9�:�:��{�{�D��}�}�,�!-�d�k�k�!:�����+�+�8�8� �M�M�4�;�;�8�<�%)�]�]�%A�%A� $�
�
�t�{�{�&<�F�!�K�K�/�/�;�;� $�
�
�t�{�{�<��9�9��1�1�$�)�)�V�D�D��3�3���
�
�#-�4�/�/�����}�}���9�9�(��.�G���$�#�J�&*�Y�Y��%6�-1�L�L�N�	<�&=� >�>� �1�1�$�)�)�G�1�L�L���~� )�?� A�A�"�4��#�5�5�d�;�;�$� '��1B�T�1I�04����!@�&A� B�B���J�(C�d�(J�$(�L�L�N�4�5�6�6��[!�K�K�/�/�;�;� $�
�
�t�{�{�<��)�:�6���D��,�,�.�C� �'�#�a�&�#�a�&�#�a�&�26�,�,�.�#B�"C�D�D�s&� AN<�=0M=�-:N<�=<N9�9N<�<APc�$�|jjj||�}|rH|\}}|rA|j|j|�tj
j|||�g�Stj
j|||�S)zSLoad tests from all names, returning a suite containing all
        tests.
        )r"r\�loadTestsFromNamesr)r,r)r.�namesr��plug_resr�s     r/r�zTestLoader.loadTestsFromNames�s����;�;�&�&�9�9�%��H���#�L�E�5������O�O�E�*��'�'�:�:�4���O�(����"�"�5�5�d�E�6�J�Jr0c�8��g}|jj}|j|�D]}|j|��|stt
|�|�S|j
tt
|�|�D�cgc]}|��c}�|j|�Scc}w)z6Load tests from a unittest.TestCase subclass.
        )r"r\�loadTestsFromTestCaserl�superrr�r))r.rFrGr\�caser�s     �r/r�z TestLoader.loadTestsFromTestCase�s�������+�+�%�%���1�1�-�@�D��L�L���A�
���T�@��O�O�
���
�:�t�
:�=�
I�
K�
I��T�
I�
K�	L����u�%�%��
Ks�6	Bc	�R�||jfd�}t|t|��D�cgc]}|jt	||�|��� }}|j
jj|�D]}|j|��|jt||���Scc}w)a!Load tests from a test class that is *not* a unittest.TestCase
        subclass.

        In this case, we can't depend on the class's `__init__` taking method
        name arguments, so we have to compose a MethodTestCase for each
        method in the class that looks testlike.
        c��t||d�}t|�r
t||�}nt|�sy|j	|�Sr3r4r7s    r/r<z1TestLoader.loadTestsFromTestClass.<locals>.wanted�r=r0r�)r'rBrCr�r5r"r\�loadTestsFromTestClassrlr)r)r.r9r<r�rGrys      r/r�z!TestLoader.loadTestsFromTestClass�s���!�d�m�m�	(�$�F�C��H�5�7�5�T����w�s�D�1�3�7�5�	�7��K�K�'�'�>�>�s�C�D��L�L���D����{�5�#�>�?�?��	7s�#B$c���	|j||�S#ttf$r�tj�}	t|�}n#t$r�d}YnxYwt
|d|d|d|��cYSxYw)Nrr}r~r)�	_makeTestrmrnrorprr)r.r�r�r�r�s     r/r�zTestLoader.makeTest	s��	A��>�>�#�v�.�.��!�:�.�	��	A��,�,�.�C�
�#�C�(���$�
��
�����3�q�6�3�q�6�3�q�6�4�@�@�s ��%A2�A�A2�
A�A2c���g}	t|�}|jjj	||�D]}|j|��	|r|j
|�S	t|�r(|r&t|tj�st||�}t|t j"�r|St%|�rm|r/|j&|j(k7rt+||j(�}t-|t j"�r|j/|�S|j1|�St3|�rb|�|j4}t-|t j"�r||j(�St7|�r|j9||�St;|�St|�rY|r/|j&|j(k7rt=||j(�}t7|�r|j?||�StA|�SttBd|z|��S#t$r�d}Y��xYw#ttf$r�tj�}t|d|d|d|��cYSxYw)zVGiven a test object and its parent, return a test case
        or test suite.
        Nrr}r~rzCan't make a test from %s)"rrmr"r\r�rlr)rnrorprrr��types�
ModuleTyperr,�TestCaserr�r�r�
issubclassr�r�rr�rr�rrr�rr�)r.r�r�r�r�ryr�s       r/r�zTestLoader._makeTests���
�	���$�D�
�K�K�'�'�0�0��f�=�D����d�#�>�	A�����z�2�2���c�?�v�j���AQ�AQ�.R�!���-�C��c�8�,�,�-��J�
�S�\��#�.�.�F�O�O�;�&�s�F�O�O�<���#�x�0�0�1��1�1�#�6�6��2�2�3�7�7�
�c�]��~������&�(�"3�"3�4��c�l�l�+�+��s�#��<�<�S�&�I�I�)�#�.�.�
��_��#�.�.�F�O�O�;�%�c�6�?�?�;���3���2�2�3��?�?�'��,�,��9�6��<�#'�)�
)��a!�	��	��D��"�:�.�	��	A��,�,�.�C��3�q�6�3�q�6�3�q�6�4�@�@�s�H
�H �

H� =Ic��|}|jd�}|D]}|t||d�}}�|�ttd|z�}|fS)z#Resolve name within module
        rQNzNo such test %s)�splitr5rr�)r.r�r�r��parts�partr�s       r/r�zTestLoader.resolveSsS�����
�
�3����D��w�s�D�$�7�C�F���;��*�&7�$�&>�?�C��s�{�r0c��t|t�s|t�}}||fSt|�dk(r|dt�}}||fSt|�dkDsJ�|d|dd}}||fS)z�Given the yield value of a test generator, return a func and args.

        This is used in the two loadTestsFromGenerator* methods.

        r}rN)r��tuple�len)r.ryr�r�s    r/r�zTestLoader.parseGeneratedTest_s|���$��&�"�E�G�s�I��#�~����Y�!�^�"�1�g�u�w�s�I��#�~���t�9�q�=� �=�"�1�g�t�A�B�x�s�I��#�~�r0)NNNNr3rM)r�r��__qualname__�__doc__r"r$r#r'r)r-r@rKrOrWrjr�r�r�rir�r�r�r�r�r�r��
__classcell__)r�s@r/rr-s������F��H��J��H��J�>B��(+�T�0*�)�K%�Z;�8M�,*M�X2C�hj6�XK�&�"@�*
A�9)�v
�
r0)<r��loggingr^ror,r��inspectr�nose.pyversionrr�	nose.caserr�nose.failurer�nose.configr	�
nose.importerr
rr�
nose.selectorr
r�	nose.utilrrrrrrrrrr�
nose.suiterrrrrr��	getLoggerr�rZrJ�normpathr%�abspathr&�joinrbr�re�isfilerc�__all__rr�r0r/�<module>r�s�����	�
����3�6� ��9�9�6�#�#�#�C�B�0���g����!���g�g����
�W�W�_�_�
�
�'�'�,�,��
�7�7�=�=���G�G�N�N�	��,�
-����$�$��B�r0

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic