OwlCyberSecurity - MANAGER
Edit File: case.cpython-312.pyc
� ����U��g�3����������������������� ����d�Z�ddlZddlZddlZddlmZ�ddlmZ�ddlm Z �ddl mZmZm Z �ddlZ�ej������������������e�������ZdgZ�G�d��dej&�������������������������Z�G�d ��d ej&�������������������������Z�G�d��de�������Z�G�d ��de�������Zy)z�nose unittest.TestCase subclasses. It is not necessary to subclass these classes when writing tests; they are used internally by nose.loader.TestLoader to create test cases from test functions and methods in test classes. �����N)� isfunction)�Config)�Failure)�resolve_name�test_address�try_run�Testc��������������������z�����e�Zd�ZdZdZdd�Zd��Zd��Zd��Zd��Z d ��Z d ��Zd��Zd��Z d ��Z�eeddd�������Zd��Zd��Zd��Zy)r ���z�The universal test case wrapper. When a plugin sees a test, it will always see an instance of this class. To access the actual test case that will be run, access the test property of the nose.case.Test instance. FNc������������������ ����t��������|t��������j�������������������������st��������d|z����������||�_��������|� t����������������}||�_��������d�|�_��������d�|�_��������||�_ ��������|j������������������|�_ ��������d�|�_��������t��������j������������������j������������������|���������y�)NzTnose.case.Test called with argument %r that is not callable. A callable is required.)� isinstance�collections�Callable� TypeError�testr����config�tbinfo�capturedOutput�resultProxy�plugins�passed�unittest�TestCase�__init__)�selfr���r���r���s��� �8/opt/hc_python/lib/python3.12/site-packages/nose/case.pyr���z Test.__init__���s��������$�� 4� 4�5���G�"�#��$�� $���� ��>��X�F�������"���&����~�~���������"�"�4�(�����c������������������&������|�j�������������������|i�|��S��N)�run)r����arg�kwargs��� r����__call__z Test.__call__-���s�������t�x�x��&��&�&r���c������������������j�����|�j�������������������j������������������|��������}|�|S�t��������|�j�������������������������S�r���)r����testName�strr���)r����names��� r����__str__zTest.__str__0���s/�������|�|�$�$�T�*�����K��4�9�9�~�r���c������������������ �����d|�j�������������������z��S�)NzTest(%r))r����r���s��� r����__repr__z Test.__repr__6���s�������D�I�I�%�%r���c������������������`����� �|j�������������������}�||�j��������������������������y#�t��������$�r�Y�yw�xY�w)z>Called after test is complete (after result.stopTest) N)� afterTestr����AttributeError)r����resultr,���s��� r���r,���zTest.afterTest9���s4������ !��(�(�I�� �d�i�i� ����� �� ������!�� -�-c������������������`����� �|j�������������������}�||�j��������������������������y#�t��������$�r�Y�yw�xY�w)z<Called before test is run (before result.startTest) N)� beforeTestr���r-���)r���r.���r1���s��� r���r1���zTest.beforeTestC���s4������ "��*�*�J�� �t�y�y�!����� �� �r/���c������������������<�����t��������j��������������������������\��}}}|||fS�)z Extract exception info. )�sys�exc_info)r����exc�exv�tbs��� r���r4���z Test.exc_infoM���s!��������|�|�~���S�"��S�"�~�r���c������������������6�����|�j�������������������j��������������������������S�)z0Get a short(er) description of the test )r����idr)���s��� r���r9���zTest.idS���s��������y�y�|�|�~�r���c�����������������������t��������|�j������������������d�������r|�j������������������j��������������������������S�t��������|�j�������������������������S�)��Return a round-trip name for this test, a name that can be fed back as input to loadTestByName and (assuming the same plugin configuration) result in the loading of this test. �address)�hasattrr���r<���r���r)���s��� r���r<���zTest.addressX���s6������ ��4�9�9�i�(��9�9�$�$�&�&�� �� � �*�*r���c����������������������� �|�j�������������������j������������������S�#�t��������$�r�Y�nw�xY�w �|�j�������������������j������������������S�#�t��������$�r�Y�nw�xY�w �t ��������|�j�������������������j �������������������������S�#�t��������$�r�Y�y�w�xY�wr���)r����contextr-���� __class__r���� __module__r)���s��� r����_contextz Test._contextc���s������ ��9�9�$�$�$���� �� �� ��9�9�&�&�&���� �� �� ��� � � 4� 4�5�5���� ��� �s-������ $�$�>�� A � A �A-��- A9�8A9z-Get the context object of this test (if any).c������������������B����|�j�������������������r|�j������������������||��������} � �|�j������������������|��������|�j������������������|��������|�j������������������|��������y#�t��������$�r����t ��������j ��������������������������}|j ������������������|�|��������Y��ExY�w#�|�j������������������|��������w�xY�w)a��Modified run for the test wrapper. From here we don't call result.startTest or stopTest or addSuccess. The wrapper calls addError/addFailure only if its own setup or teardown fails, or running the wrapped test fails (eg, if the wrapped "test" is not callable). Two additional methods are called, beforeTest and afterTest. These give plugins a chance to modify the wrapped test before it is called and do cleanup after it is called. They are called unconditionally. N)r���r1����runTest�KeyboardInterruptr3���r4����addErrorr,���)r���r.����errs��� r���r���zTest.runt���s������������%�%�f�d�3�F� #� +�����'����V�$�� �N�N�6�"�� �%�� �� +��l�l�n������c�*���N�N�6�"�s����"A��1B�B��Bc������������������~�����|�j�������������������}|�j������������������j������������������j������������������|��������}|�|}�||��������y)z�Run the test. Plugins may alter the test by returning a value from prepareTestCase. The value must be callable and must accept one argument, the result instance. N)r���r���r����prepareTestCase)r���r.���r���� plug_tests��� r���rD���zTest.runTest����s9������ ��y�y���K�K�'�'�7�7��=� �� ��D��V�r���c�����������������������|�j�������������������j������������������|��������}|�|S�|�j������������������} �|j������������������j ��������������������������|_�������� �|�j������������������j��������������������������} �|t��������|�j�������������������������k(��ry� �|S�#�t ��������$�r3� �|j������������������j ��������������������������|_��������n#�t ��������$�r�Y�nw�xY�wY��sw�xY�w#�t��������$�r�Y��gw�xY�w#�t��������$�r�Y�|S�w�xY�wr���) r����describeTestr����_testMethodDoc�stripr-����_TestCase__testMethodDoc�shortDescription� Exceptionr%���)r����descr���s��� r���rP���zTest.shortDescription����s��������|�|�(�(��.�����K���y�y�� �"&�"5�"5�";�";�"=�D�� ��9�9�-�-�/�D� ��s�4�9�9�~�%���&�����/��� � ���1�1�7�7�9���-��!�� �� �� ����� �� � ����� �� ��� �sY����B�� C��(C�� C��B.�-C��. B:�7C��9B:�:C��?C�� C�C� C�C)NN)�__name__rA����__qualname__�__doc__�__test__r���r"���r'���r*���r,���r1���r4���r9���r<���rB����propertyr?���r���rD���rP�����r���r���r ���r ������se���������H�)�"'��&�!�"��� +� ���x��t�I�K�G�#�6 � r���c��������������������&�����e�Zd�ZdZdZd��Zd��Zd��Zy)�TestBasezBCommon functionality for FunctionTestCase and MethodTestCase. Fc�����������������������t��������|��������S�r���)r%���r)���s��� r���r9���zTestBase.id����s�������4�y�r���c������������������6������|�j�������������������|�j���������������������y�r���)r���r ���r)���s��� r���rD���zTestBase.runTest����s�������� � �4�8�8�r���c����������������������t��������|�j������������������d�������r|�j������������������j������������������S�|�j��������������������������\��}}t ��������|dd��������}|st��������|��������}|j ��������������������������j������������������d�������d���j ��������������������������S�)N�descriptionrU���� r���)r=���r���r^����_descriptors�getattrr%���rN����split)r����funcr ����docs��� r���rP���zTestBase.shortDescription����sq�������4�9�9�m�,��9�9�(�(�(��%�%�'� ��c��d�I�t�,����d�)�C��y�y�{� � ��&�q�)�/�/�1�1r���N)rS���rA���rT���rU���rV���r9���rD���rP���rX���r���r���rZ���rZ�������s��������H���2r���rZ���c��������������������l�����e�Zd�ZdZdZdd�e��������dfd�Zd��Zd��Z�e eddd�������Z d��Zd ��Zd ��Z e Zd��Zy)�FunctionTestCasez�TestCase wrapper for test functions. Don't use this class directly; it is used internally in nose to create test cases for test functions. FNc������������������t�����||�_���������||�_��������||�_��������||�_��������||�_��������t ��������j ������������������|���������y)a��Initialize the MethodTestCase. Required argument: * test -- the test function to call. Optional arguments: * setUp -- function to run at setup. * tearDown -- function to run at teardown. * arg -- arguments to pass to the test function. This is to support generator functions that yield arguments. * descriptor -- the function, other than the test, that should be used to construct the test name. This is to support generator functions. N)r���� setUpFunc�tearDownFuncr ���� descriptorrZ���r���)r���r����setUp�tearDownr ���rj���s��� r���r���zFunctionTestCase.__init__����s6������*��� ����$������$������$�r���c������������������n�����|�j��������������������t��������|�j��������������������������S�t��������|�j�������������������������S��r;���)rj���r���r���r)���s��� r���r<���zFunctionTestCase.address����s,������ ��?�?�&�����0�0��� � �*�*r���c������������������@�����t��������|�j������������������j�������������������������S�r���)r���r���rA���r)���s��� r���rB���zFunctionTestCase._context���s�������D�I�I�0�0�1�1r���z!Get context (module) of this testc������������������n�����|�j�������������������r|�j���������������������������yd}t��������|�j������������������|��������y)z=Run any setup function attached to the test function )�setuprk���rh���N)rh���r���r����r����namess��� r���rk���zFunctionTestCase.setUp��s(��������>�>��N�N��3�E��D�I�I�u�%r���c������������������n�����|�j�������������������r|�j���������������������������yd}t��������|�j������������������|��������y)z@Run any teardown function attached to the test function )�teardownrl���ri���N)ri���r���r���rr���s��� r���rl���zFunctionTestCase.tearDown��s,��������������<�E��D�I�I�u�%r���c�����������������������|�j��������������������������\��}}t��������|d�������r |j������������������}n|j������������������}|j�������������������d|��}|r|�|��}|S��N�compat_func_name�.)r`���r=���rx���rS���rA����r���rc���r ���r&���s��� r���r'���zFunctionTestCase.__str__��sU�������%�%�'� ��c��4�+�,��(�(�D��=�=�D��/�/�4�0���!�3�'�D���r���c������������������z�����|�j�������������������r|�j�������������������|�j������������������fS�|�j������������������|�j������������������fS�)af��Get the descriptors of the test function: the function and arguments that will be used to construct the test name. In most cases, this is the function itself and no arguments. For tests generated by generator functions, the original (generator) function and args passed to the generated function are returned. )rj���r ���r���r)���s��� r���r`���zFunctionTestCase._descriptors&��s1��������?�?��?�?�D�H�H�,�,��9�9�d�h�h�&�&r���)rS���rA���rT���rU���rV����tupler���r<���rB���rW���r?���rk���rl���r'���r*���r`���rX���r���r���rf���rf�������sW������� ��H�#'�$�E�G� � �8+�2��x��t�=�?�G�&�&����H�'r���rf���c��������������������j�����e�Zd�ZdZdZd�e��������dfd�Zd��ZeZd��Z d��Z �ee ddd�������Zd ��Z d ��Zd��Zy)�MethodTestCasez�Test case wrapper for test methods. Don't use this class directly; it is used internally in nose to create test cases for test methods. FNc������������������l����||�_���������||�_��������||�_��������||�_��������t ��������|�������rt��������d��������|j������������������j������������������|�_��������|�j��������������������������|�_ ��������|�j�������������������1|�j�������������������j������������������}t��������|�j������������������|�������|�_��������t��������j������������������|���������y)a���Initialize the MethodTestCase. Required argument: * method -- the method to call, may be bound or unbound. In either case, a new instance of the method's class will be instantiated to make the call. Note: In Python 3.x, if using an unbound method, you must wrap it using pyversion.unbound_method. Optional arguments: * test -- the test function to call. If this is passed, it will be called instead of getting a new bound method of the same name as the desired method from the test instance. This is to support generator methods that yield inline functions. * arg -- arguments to pass to the test function. This is to support generator methods that yield arguments. * descriptor -- the function, other than the test, that should be used to construct the test name. This is to support generator methods. z_Unbound methods must be wrapped using pyversion.unbound_method before passing to MethodTestCaseN)�methodr���r ���rj���r���� ValueError�__self__r@����cls�instrS���ra���rZ���r���)r���r����r���r ���rj����method_names��� r���r���zMethodTestCase.__init__<��s�������.������ ����$����f���~����?�?�,�,����H�H�J�� ��9�9���+�+�.�.�K��� � �;�7�D�I����$�r���c������������������������|�j��������������������������\��}}t��������|d�������r |j������������������}n|j������������������}|�j������������������j �������������������d|�j������������������j�������������������d|��}|r|�|��}|S�rw���)r`���r=���rx���rS���r����rA���rz���s��� r���r'���zMethodTestCase.__str__`��sk�������%�%�'� ��c��4�+�,��(�(�D��=�=�D�!�X�X�0�0�!�X�X�.�.�!�#����!�3�'�D��r���c������������������n�����|�j��������������������t��������|�j��������������������������S�t��������|�j�������������������������S�rn���)rj���r���r����r)���s��� r���r<���zMethodTestCase.addressn��s,������ ��?�?�&�����0�0�����,�,r���c�����������������������|�j�������������������S�r���)r����r)���s��� r���rB���zMethodTestCase._contextx��s�������x�x�r���z Get context (class) of this testc������������������0�����t��������|�j������������������d��������y�)N)rq���rk����r���r����r)���s��� r���rk���zMethodTestCase.setUp}��s�������� � �-�.r���c������������������0�����t��������|�j������������������d��������y�)N)ru���rl���r����r)���s��� r���rl���zMethodTestCase.tearDown���s�������� � �3�4r���c������������������z�����|�j�������������������r|�j�������������������|�j������������������fS�|�j������������������|�j������������������fS�)ag��Get the descriptors of the test method: the method and arguments that will be used to construct the test name. In most cases, this is the method itself and no arguments. For tests generated by generator methods, the original (generator) method and args passed to the generated method or function are returned. )rj���r ���r����r)���s��� r���r`���zMethodTestCase._descriptors���s1��������?�?��?�?�D�H�H�,�,��;�;����(�(r���)rS���rA���rT���rU���rV���r|���r���r'���r*���r<���rB���rW���r?���rk���rl���r`���rX���r���r���r~���r~���4��sU������� ��H�$(�e�g�$��" �H���H�-���x��t�<�>�G�/�5�)r���r~���)rU����loggingr3���r����inspectr����nose.configr����nose.failurer���� nose.utilr���r���r���r ���� getLoggerrS����log�__all__r���r ���rZ���rf���r~���rX���r���r����<module>r�������s���������� �������� ��9��9����g����!����(��f�8����f�R2�x� � ��2�*_'�x��_'�DZ)�X��Z)r���