AlkantarClanX12

Your IP : 18.118.140.78


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/unittest/__pycache__/case.cpython-311.opt-1.pyc

�

c��f����B�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZdZe��ZdZGd�d	e��ZGd
�de��ZGd�d
e��ZGd�de��Zd�Zd�Zd�Zd�ZgZ d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(Gd�d��Z)Gd�de)��Z*Gd �d!e*��Z+Gd"�d#e*��Z,Gd$�d%ej-��Z.Gd&�d'e��Z/Gd(�d)e/��Z0Gd*�d+e/��Z1dS),zTest case implementation�N�)�result)�strclass�	safe_repr�_count_diff_all_purpose�_count_diff_hashable�_common_shorten_reprTz@
Diff is %s characters long. Set self.maxDiff to None to see it.c��eZdZdZdS)�SkipTestz�
    Raise this exception in a test to skip it.

    Usually you can use TestCase.skipTest() or one of the skipping decorators
    instead of raising this directly.
    N��__name__�
__module__�__qualname__�__doc__���4/opt/alt/python311/lib64/python3.11/unittest/case.pyrrs���������rrc��eZdZdZdS)�_ShouldStopz
    The test should stop.
    Nrrrrrr!����������rrc��eZdZdZdS)�_UnexpectedSuccessz7
    The test was supposed to fail, but it didn't!
    Nrrrrrr&rrrc�8�eZdZdd�Zejdd���ZdS)�_OutcomeNc�h�d|_||_t|d��|_d|_d|_dS)NF�
addSubTestT)�expecting_failurer�hasattr�result_supports_subtests�success�expectedFailure)�selfrs  r�__init__z_Outcome.__init__-s8��!&������(/���(E�(E��%����#����rFc#�BK�|j}d|_	dV�|r(|jr!|j�|j|d��n�#t$r�t
$r4}d|_t
|j|t|����Yd}~nzd}~wt$rYnktj
��}|jr||_nAd|_|r"|j�|j||��nt|j||��d}YnxYw|jo||_dS#|jo||_wxYw)NTF)r rr�	test_case�KeyboardInterruptr�_addSkip�strr�sys�exc_inforr!�	_addError)r"r%�subTest�old_success�er*s      r�testPartExecutorz_Outcome.testPartExecutor4sq�����l�����	8��E�E�E�,�
M�4�<�
M���&�&�y�':�I�t�L�L�L���-!�	�	�	���	5�	5�	5� �D�L��T�[�)�S��V�V�4�4�4�4�4�4�4�4������	�	�	��D�	��|�~�~�H��%�
@�'/��$�$�$����@��K�*�*�9�+>�	�8�T�T�T�T��d�k�9�h�?�?�?��H�H�H����
 �<�7�K�D�L�L�L��4�<�7�K�D�L�7�7�7�7s;�A�+D�C;�*B�?D�
C;�D�A&C;�9D�D�N)F)r
rrr#�
contextlib�contextmanagerr/rrrrr,sL������$�$�$�$���8�8�8���8�8�8rrc��t|dd��}|�|||��dStjdtd��|j|��dS)N�addSkipz4TestResult has no addSkip method, skips not reported�)�getattr�warnings�warn�RuntimeWarning�
addSuccess)rr%�reasonr4s    rr'r'Usf���f�i��.�.�G�����	�6�"�"�"�"�"��
�L�$�a�	)�	)�	)����)�$�$�$�$�$rc��|�C|�Ct|d|j��r|j||��dS|j||��dSdSdS)Nr)�
issubclass�failureException�
addFailure�addError)r�testr*s   rr+r+^si��
��h�2��h�q�k�4�#8�9�9�	,��F��d�H�-�-�-�-�-��F�O�D�(�+�+�+�+�+�	��2�2rc��|Sr0r)�objs r�_idrDes���Jrc���t|��}	|j}|j}n/#t$r"t	d|j�d|j�d���d�wxYw||��}|||ddd��|S)N�'�.z6' object does not support the context manager protocol)�type�	__enter__�__exit__�AttributeError�	TypeErrorrr)�cm�
addcleanup�cls�enter�exitrs      r�_enter_contextrRis����r�(�(�C�O��
���|�����O�O�O��D�C�N�D�D�S�-=�D�D�D�E�E�JN�	O�O�����U�2�Y�Y�F��J�t�R��t�T�*�*�*��Ms	� �,Ac�@�t�|||f��dS)znSame as addCleanup, except the cleanup items are called even if
    setUpModule fails (unlike tearDownModule).N)�_module_cleanups�append)�function�args�kwargss   r�addModuleCleanuprYys%�����X�t�V�4�5�5�5�5�5rc�,�t|t��S)z&Same as enterContext, but module-wide.)rRrY)rMs r�enterModuleContextr[~s���"�.�/�/�/rc���g}trZt���\}}}	||i|��n,#t$r}|�|��Yd}~nd}~wwxYwt�Z|r|d�dS)zWExecute all module cleanup functions. Normally called for you after
    tearDownModule.Nr)rT�pop�	ExceptionrU)�
exceptionsrVrWrX�excs     r�doModuleCleanupsra�s����J�
�#�!1�!5�!5�!7�!7���$��	#��H�d�%�f�%�%�%�%���	#�	#�	#����c�"�"�"�"�"�"�"�"�����	#����	�#�����m���s�1�
A�A�Ac�d���fd�}t�tj��r�}d�||��S|S)z&
    Unconditionally skip a test.
    c���t|t��s!tj|���fd���}|}d|_�|_|S)Nc�"��t����r0�r)rWrXr;s  �r�skip_wrapperz-skip.<locals>.decorator.<locals>.skip_wrapper�s����v�&�&�&rT)�
isinstancerH�	functools�wraps�__unittest_skip__�__unittest_skip_why__)�	test_itemrfr;s  �r�	decoratorzskip.<locals>.decorator�s^����)�T�*�*�	%�
�_�Y�
'�
'�
'�
'�
'�
'�(�
'�
'�$�I�&*�	�#�*0�	�'��r�)rg�types�FunctionType)r;rmrls`  r�skiprq�sS���	�	�	�	�	��&�%�,�-�-�$��	����y��#�#�#��rc�2�|rt|��StS)z/
    Skip a test if the condition is true.
    �rqrD��	conditionr;s  r�skipIfrv�s�����F�|�|���Jrc�2�|st|��StS)z3
    Skip a test unless the condition is true.
    rsrts  r�
skipUnlessrx�s�����F�|�|���Jrc��d|_|S)NT)�__unittest_expecting_failure__)rls rr!r!�s��/3�I�,��rc���t|t��rt�fd�|D����St|t��ot	|���S)Nc3�8�K�|]}t|���V��dSr0)�_is_subtype)�.0r.�basetypes  �r�	<genexpr>z_is_subtype.<locals>.<genexpr>�s-�����>�>��;�q�(�+�+�>�>�>�>�>�>r)rg�tuple�allrHr=)�expectedrs `rr}r}�sW����(�E�"�"�?��>�>�>�>�X�>�>�>�>�>�>��h��%�%�H�*�X�x�*H�*H�Hrc��eZdZd�Zd�ZdS)�_BaseTestCaseContextc��||_dSr0)r%)r"r%s  rr#z_BaseTestCaseContext.__init__�s
��"����rc�v�|j�|j|��}|j�|���r0)r%�_formatMessage�msgr>)r"�standardMsgr�s   r�
_raiseFailurez"_BaseTestCaseContext._raiseFailure�s1���n�+�+�D�H�k�B�B���n�-�-�c�2�2�2rN)r
rrr#r�rrrr�r��s2������#�#�#�3�3�3�3�3rr�c��eZdZdd�Zd�ZdS)�_AssertRaisesBaseContextNc��t�||��||_||_|�t	j|��}||_d|_d|_dSr0)	r�r#r�r%�re�compile�expected_regex�obj_namer�)r"r�r%r�s    rr#z!_AssertRaisesBaseContext.__init__�sU���%�%�d�I�6�6�6� ��
�"����%��Z��7�7�N�,�����
�����rc���	t|j|j��st|�d|j�����|sM|�dd��|_|r,ttt|�����d����|d}S|^}}	|j	|_
n$#t$rt|��|_
YnwxYw|5||i|��ddd��n#1swxYwYd}dS#d}wxYw)z�
        If args is empty, assertRaises/Warns is being used as a
        context manager, so check for a 'msg' kwarg and return self.
        If args is not empty, call a callable passing positional and keyword
        arguments.
        z() arg 1 must be r�Nz1 is an invalid keyword argument for this function)
r}r��
_base_typerL�_base_type_strr]r��next�iterr
r�rKr()r"�namerWrX�callable_objs     r�handlez_AssertRaisesBaseContext.handle�sz��	��t�}�d�o�>�>�
=��!%���t�':�':�!<�=�=�=��
�!�:�:�e�T�2�2����M�#�7;�D��L�L�7I�7I�7I�7I�%L�M�M�M���D�D�#'��L�4�
2� ,� 5��
�
��!�
2�
2�
2� #�L� 1� 1��
�
�
�
2�����
.�
.���d�-�f�-�-�-�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��D�D�D��4�D�K�K�K�KsZ�A?C �C �	B�C �B7�4C �6B7�7C �<	C�C �C�C �C�C � C$r0)r
rrr#r�rrrr�r��s7��������������rr�c�F�eZdZdZeZdZd�Zd�Ze	e
j��ZdS)�_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typesc��|Sr0r�r"s rrIz_AssertRaisesContext.__enter__�s���rc��|��	|jj}n$#t$rt|j��}YnwxYw|jr/|�d�||j����n=|�d�|����ntj|��t||j��sdS|�
d��|_|j�dS|j}|�
t|����s;|�d�|jt|������dS)Nz{} not raised by {}z
{} not raisedFT�"{}" does not match "{}")r�r
rKr(r�r��format�	traceback�clear_framesr=�with_traceback�	exceptionr��search�pattern)r"�exc_type�	exc_value�tb�exc_namer�s      rrJz_AssertRaisesContext.__exit__�se����
.��=�1����!�
.�
.�
.��t�}�-�-����
.�����}�
E��"�"�#8�#?�#?��@D�
�$O�$O�P�P�P�P��"�"�?�#9�#9�(�#C�#C�D�D�D�D��"�2�&�&�&��(�D�M�2�2�	��5�"�1�1�$�7�7�����&��4��,���$�$�S��^�^�4�4�	>����9�@�@�#�+�S��^�^� =� =�
>�
>�
>��ts��2�2N)
r
rrr�
BaseExceptionr�r�rIrJ�classmethodro�GenericAlias�__class_getitem__rrrr�r��sS������M�M��J�D�N�������6$��E�$6�7�7���rr�c�&�eZdZdZeZdZd�Zd�ZdS)�_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typesc�6�ttj�����D]}t	|dd��ri|_�t
jd���|_|j�	��|_t
j
d|j��|S)N�__warningregistry__T)�record�always)�listr)�modules�valuesr6r�r7�catch_warnings�warnings_managerrI�simplefilterr�)r"�vs  rrIz_AssertWarnsContext.__enter__ s����c�k�(�(�*�*�+�+�	+�	+�A��q�/��6�6�
+�(*��%�� (� 7�t� D� D� D����-�7�7�9�9��
���h��
�6�6�6��rc���|j�|||��|�dS	|jj}n$#t$rt|j��}YnwxYwd}|jD]s}|j}t||j��s�|�|}|j	�(|j	�
t|����s�R||_|j|_|j
|_
dS|�@|�d�|j	jt|������|jr0|�d�||j����dS|�d�|����dS)Nr�z{} not triggered by {}z{} not triggered)r�rJr�r
rKr(r7�messagergr�r��warning�filename�linenor�r�r�r�)r"r�r�r�r��first_matching�m�ws        rrJz_AssertWarnsContext.__exit__+s�����&�&�x��B�?�?�?����F�	*��}�-�H�H���	*�	*�	*��4�=�)�)�H�H�H�	*��������
	�
	�A��	�A��a���/�/�
���%�!"���#�/��'�.�.�s�1�v�v�6�6�0���D�L��J�D�M��(�D�K��F�F��%����9�@�@��(�0�#�n�2E�2E� G� G�
H�
H�
H��=�	D����7�>�>�x�?C�}� N� N�
O�
O�
O�
O�
O�
���1�8�8��B�B�C�C�C�C�Cs�/�A�AN)	r
rrr�Warningr�r�rIrJrrrr�r�sG������L�L��J�?�N�	�	�	� D� D� D� D� Drr�c��eZdZd�ZdS)�_OrderedChainMapc#�~K�t��}|jD]$}|D]}||vr|�|��|V�� �%dSr0)�set�maps�add)r"�seen�mapping�ks    r�__iter__z_OrderedChainMap.__iter__Os`�����u�u���y�	�	�G��
�
���D�=�=��H�H�Q�K�K�K��G�G�G��
�	�	rN)r
rrr�rrrr�r�Ns#����������rr�c���eZdZdZeZdZdZdZ�fd�Z	dOd�Z
d�Zd	�Zd
�Z
ed���Zed���Zd
�Zd�Zed���Zed���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zejefd���Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&dPd!�Z'd"�Z(ed#���Z)d$�Z*d%�Z+d&�Z,dPd'�Z-dPd(�Z.dPd)�Z/d*�Z0d+�Z1d,�Z2dQd-�Z3dQd.�Z4d/�Z5dPd0�Z6dPd1�Z7dPd2�Z8		dRd3�Z9		dRd4�Z:dQd5�Z;d6�Z<dPd7�Z=dPd8�Z>dPd9�Z?dPd:�Z@dPd;�ZAdPd<�ZBdPd=�ZCdPd>�ZDdPd?�ZEdPd@�ZFdPdA�ZGdPdB�ZHdPdC�ZIdPdD�ZJdPdE�ZKdPdF�ZLdPdG�ZMdPdH�ZNdPdI�ZOdJ�ZPdK�ZQdPdL�ZRdPdM�ZSdN�ZTeTe7��xZUZVeTe8��xZWZXeTe9��xZYZZeTe:��xZ[Z\eTe/��xZ]Z^eTe1��Z_eTe.��Z`eTeP��ZaeTeR��ZbeTeS��Zc�xZdS)S�TestCaseaWA class whose instances are single test cases.

    By default, the test code itself should be placed in a method named
    'runTest'.

    If the fixture may be used for many test cases, create as
    many test methods as are needed. When instantiating such a TestCase
    subclass, specify in the constructor arguments the name of the test method
    that the instance is to execute.

    Test authors should subclass TestCase for their own tests. Construction
    and deconstruction of the test's environment ('fixture') can be
    implemented by overriding the 'setUp' and 'tearDown' methods respectively.

    If it is necessary to override the __init__ method, the base class
    __init__ method must always be called. It is important that subclasses
    should not change the signature of their __init__ method, since instances
    of the classes are instantiated automatically by parts of the framework
    in order to be run.

    When subclassing TestCase, you can set these attributes:
    * failureException: determines which exception will be raised when
        the instance's assertion methods fail; test methods raising this
        exception will be deemed to have 'failed' rather than 'errored'.
    * longMessage: determines whether long messages (including repr of
        objects used in assert methods) will be printed on failure in *addition*
        to any explicit message passed.
    * maxDiff: sets the maximum length of a diff in failure messages
        by assert methods using difflib. It is looked up as an instance
        attribute so can be configured by individual tests if required.
    Ti�ic�V��d|_g|_t��j|i|��dS)NF)�_classSetupFailed�_class_cleanups�super�__init_subclass__)rOrWrX�	__class__s   �rr�zTestCase.__init_subclass__�s5��� %��� ���!����!�4�2�6�2�2�2�2�2r�runTestc�:�||_d|_d|_	t||��}|j|_n0#t
$r#|dkrt
d|j�d|�����YnwxYwg|_d|_	i|_
|�td��|�td��|�td��|�td	��|�t d	��|�t"d
��dS)z�Create an instance of the class that will use the named test
           method when executed. Raises a ValueError if the instance does
           not have a method with the specified name.
        NzNo testr�zno such test method in �: �assertDictEqual�assertListEqual�assertTupleEqual�assertSetEqual�assertMultiLineEqual)�_testMethodName�_outcome�_testMethodDocr6rrK�
ValueErrorr��	_cleanups�_subtest�_type_equality_funcs�addTypeEqualityFunc�dictr�r�r��	frozensetr()r"�
methodName�
testMethods   rr#zTestCase.__init__�sA��
 *�����
�'���		5� ��z�2�2�J�#-�"4�D�����	4�	4�	4��Y�&�&�!�j��~�~�~�z�z�"3�4�4�4�'�&�	4���������
�
%'��!�� � ��'8�9�9�9�� � ��'8�9�9�9�� � ��(:�;�;�;�� � ��&6�7�7�7�� � ��,<�=�=�=�� � ��&<�=�=�=�=�=s�4�*A!� A!c��||j|<dS)a[Add a type specific assertEqual style function to compare a type.

        This method is for use by TestCase subclasses that need to register
        their own type equality functions to provide nicer error messages.

        Args:
            typeobj: The data type to call this function on when both values
                    are of the same type in assertEqual().
            function: The callable taking two arguments and an optional
                    msg= argument that raises self.failureException with a
                    useful error message when the two arguments are not equal.
        N)r�)r"�typeobjrVs   rr�zTestCase.addTypeEqualityFunc�s��.6��!�'�*�*�*rc�@�|j�|||f��dS)aAdd a function, with arguments, to be called when the test is
        completed. Functions added are called on a LIFO basis and are
        called after tearDown on test failure or success.

        Cleanup items are called even if setUp fails (unlike tearDown).N)r�rU�r"rVrWrXs    r�
addCleanupzTestCase.addCleanup�s'��	
����x��v�6�7�7�7�7�7rc�,�t||j��S)z�Enters the supplied context manager.

        If successful, also adds its __exit__ method as a cleanup
        function and returns the result of the __enter__ method.
        )rRr�)r"rMs  r�enterContextzTestCase.enterContext�s���b�$�/�2�2�2rc�@�|j�|||f��dS)zpSame as addCleanup, except the cleanup items are called even if
        setUpClass fails (unlike tearDownClass).N)r�rU�rOrVrWrXs    r�addClassCleanupzTestCase.addClassCleanup�s(��	��"�"�H�d�F�#;�<�<�<�<�<rc�,�t||j��S)z%Same as enterContext, but class-wide.)rRr�)rOrMs  r�enterClassContextzTestCase.enterClassContext�s���b�#�"5�6�6�6rc��dS)zAHook method for setting up the test fixture before exercising it.Nrr�s r�setUpzTestCase.setUp�����rc��dS)zAHook method for deconstructing the test fixture after testing it.Nrr�s r�tearDownzTestCase.tearDown�r�rc��dS)zKHook method for setting up class fixture before running tests in the class.Nr�rOs r�
setUpClasszTestCase.setUpClass�����rc��dS)zVHook method for deconstructing the class fixture after running all tests in the class.Nrr�s r�
tearDownClasszTestCase.tearDownClass�rrc��dS)Nrrr�s r�countTestCaseszTestCase.countTestCases�s���qrc�(�tj��Sr0)r�
TestResultr�s r�defaultTestResultzTestCase.defaultTestResult�s��� �"�"�"rc��|j}|r?|����d��d���ndS)z�Returns a one-line description of the test, or None if no
        description has been provided.

        The default implementation of this method returns the first line of
        the specified test method's docstring.
        �
rN)r��strip�split�r"�docs  r�shortDescriptionzTestCase.shortDescription�sC���!��58�B�s�y�y�{�{� � ��&�&�q�)�/�/�1�1�1�d�Brc�>�t|j���d|j��S)NrG�rr�r�r�s r�idzTestCase.id�s#��"�4�>�2�2�2�2�D�4H�4H�I�Irc�l�t|��t|��urtS|j|jkSr0)rH�NotImplementedr��r"�others  r�__eq__zTestCase.__eq__�s0����:�:�T�%�[�[�(�(�!�!��#�u�'<�<�<rc�H�tt|��|jf��Sr0)�hashrHr�r�s r�__hash__zTestCase.__hash__�s���T�$�Z�Z��!5�6�7�7�7rc�P�|j�dt|j���d|j�d�S)N� (rG�))r�rr�r�s r�__str__zTestCase.__str__s1��#�3�3�3�X�d�n�5M�5M�5M�5M�t�Oc�Oc�Oc�d�drc�B�dt|j���d|j�d�S)N�<z testMethod=�>rr�s r�__repr__zTestCase.__repr__s.������(�(�(�(�$�*>�*>�*>�@�	@rc+��K�|j�|jjsdV�dS|j}|�t|��}n|j�|��}t
|||��|_	|j�|jd���5dV�ddd��n#1swxYwY|jjs|jj	}|�|j
rt�n|jjrt�||_dS#||_wxYw)aPReturn a context manager that will return the enclosed block
        of code in a subtest identified by the optional message and
        keyword parameters.  A failure in the subtest marks the test
        case as failed but resumes execution at the end of the enclosed
        block, allowing further test code to be executed.
        NT)r,)
r�rr�r��params�	new_child�_SubTestr/r r�failfastrr!)r"r�r#�parent�
params_maprs      rr,zTestCase.subTestsI�����=� ��
�(N� ��E�E�E��F�����>�)�&�1�1�J�J���0�0��8�8�J� ��s�J�7�7��
�	#���/�/��
�t�/�L�L�
�
�����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��=�(�
"���-���%�&�/�%�%�%����.�
"�"�!�"�D�M�M�M��F�D�M�"�"�"�"s0�&!C(�B�C(�B�C(�B� ?C(�(	C1c��	|j}|||��dS#t$r.tjdt��|j|��YdSwxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)�addExpectedFailurerKr7r8r9r:)r"rr*r*s    r�_addExpectedFailurezTestCase._addExpectedFailure&s~��	/�!'�!:��
��t�X�.�.�.�.�.���	$�	$�	$��M�\�(�
*�
*�
*��F��d�#�#�#�#�#�#�	$���s��4A�Ac��	|j}||��dS#t$rXtjdt��	t
d�#t
$r'|j|tj����YYdSwxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	�addUnexpectedSuccessrKr7r8r9rr?r)r*)r"rr-s   r�_addUnexpectedSuccesszTestCase._addUnexpectedSuccess0s���	'�#)�#>� �
!� ��&�&�&�&�&���	8�	8�	8��M�_�(�
*�
*�
*�
8�(�d�2��%�
8�
8�
8�!��!�$�����7�7�7�7�7�7�7�
8����	8���s&��$A8�A�,A4�/A8�3A4�4A8c�.�|���dSr0)r�r�s r�
_callSetUpzTestCase._callSetUp?s���
�
�����rc�^�|���"tjd|�d�td���dSdS)NzFIt is deprecated to return a value that is not None from a test case (r�)�
stacklevel)r7r8�DeprecationWarning)r"�methods  r�_callTestMethodzTestCase._callTestMethodBs\���6�8�8���M�2�(.�2�2�2�3E�RS�
U�
U�
U�
U�
U�
U� �rc�.�|���dSr0)r�r�s r�
_callTearDownzTestCase._callTearDownGs���
�
�����rc��||i|��dSr0rr�s    r�_callCleanupzTestCase._callCleanupJs����$�!�&�!�!�!�!�!rNc��|�C|���}t|dd��}t|dd��}|�
|��nd}|j|��	t||j��}t|jdd��st|dd��rWt|jdd��pt|dd��}t|||��||j|��|�|��SSt|dd��pt|dd��}t|��}	||_|�	|��5|�
��ddd��n#1swxYwY|jr�||_|�	|��5|�
|��ddd��n#1swxYwYd|_|�	|��5|���ddd��n#1swxYwY|���|jrK|r9|jr|�||j��n&|�|��n|j|��|d|_d}d|_|j|��|�|��SS#d|_d}d|_wxYw#|j|��|�|��wwxYw)N�startTestRun�stopTestRunrjFrkrnrz)rr6�	startTestr�r�r'�stopTestrr�r/r0r rr6r8�
doCleanupsr!r+r.r:)r"rr<r=r��skip_whyr�outcomes        r�runzTestCase.runMs����>��+�+�-�-�F�"�6�>�4�@�@�L�!�&�-��>�>�K��'��������K��������2	� ��t�';�<�<�J����(;�U�C�C�
��
�$7��?�?�
�$�D�N�4K�R�P�P�P�&�z�3J�B�O�O�����x�0�0�0��P
�F�O�D�!�!�!��&���
�
�
�
�'�M��>��F�F�M��
�$D�e�L�L�
��v�&�&�G�
%� '��
��-�-�d�3�3�&�&��O�O�%�%�%�&�&�&�&�&�&�&�&�&�&�&����&�&�&�&��?�-�0A�G�-� �1�1�$�7�7�9�9��,�,�Z�8�8�8�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9�05�G�-� �1�1�$�7�7�-�-��*�*�,�,�,�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-����!�!�!��?�0�(�0�"�2�?� �4�4�V�W�=T�U�U�U�U� �6�6�v�>�>�>�>�)��)�$�/�/�/��+/��'���!%��
�
�F�O�D�!�!�!��&���
�
�
�
�'��+/��'���!%��
�$�$�$�$��
�F�O�D�!�!�!��&���
�
�
�
�'���s��A5J(�,1J(�J�:E�J�E�J�"E�#&J�	F+�J�+F/�/J�2F/�3J�G3�'J�3G7�7J�:G7�;A*J�%J(�J%�%J(�(Kc��|jp
t��}|jrb|j���\}}}|�|��5|j|g|�Ri|��ddd��n#1swxYwY|j�b|jS)zNExecute all cleanup functions. Normally called for you after
        tearDown.N)r�rr�r]r/r:r )r"rBrVrWrXs     rr@zTestCase.doCleanups�s����-�-�8�:�:���n�	=�%)�^�%7�%7�%9�%9�"�H�d�F��)�)�$�/�/�
=�
=�!��!�(�<�T�<�<�<�V�<�<�<�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=����
=�
=�
=�
=��n�	=���s�A-�-A1�4A1c��g|_|jrk|j���\}}}	||i|��n;#t$r.|j�tj����YnwxYw|j�idSdS)zYExecute all class cleanup functions. Normally called for you after
        tearDownClass.N)�tearDown_exceptionsr�r]r^rUr)r*r�s    r�doClassCleanupszTestCase.doClassCleanups�s���#%����!�	?�%(�%8�%<�%<�%>�%>�"�H�d�F�
?���$�)�&�)�)�)�)���
?�
?�
?��'�.�.�s�|�~�~�>�>�>�>�>�
?����	�!�	?�	?�	?�	?�	?s�6�5A.�-A.c��|j|i|��Sr0)rC)r"rW�kwdss   r�__call__zTestCase.__call__�s���t�x��&��&�&�&rc���t||j��}t|jdd��st|dd��r6t|jdd��pt|dd��}t|���|���|�|��|���|jr7|j���\}}}|j	|g|�Ri|��|j�5dSdS)z6Run the test without collecting errors in a TestResultrjFrkrnN)
r6r�r�rr0r6r8r�r]r:)r"r�rArVrWrXs      r�debugzTestCase.debug�s���T�4�#7�8�8�
��D�N�$7��?�?�	%��J� 3�U�;�;�	%� ���0G��L�L�L�"�:�/F��K�K�
��8�$�$�$����������Z�(�(�(��������n�	9�%)�^�%7�%7�%9�%9�"�H�d�F��D��h�8��8�8�8��8�8�8��n�	9�	9�	9�	9�	9rc� �t|���)zSkip this test.re)r"r;s  r�skipTestzTestCase.skipTest�s���v���rc�,�|�|���)z)Fail immediately, with the given message.)r>)r"r�s  r�failz
TestCase.fail�s���#�#�C�(�(�(rc��|r;|�|dt|��z��}|�|���dS)z#Check that the expression is false.z%s is not falseN�r�rr>�r"�exprr�s   r�assertFalsezTestCase.assertFalse�sI���	-��%�%�c�+<�y����+N�O�O�C��'�'��,�,�,�	-�	-rc��|s;|�|dt|��z��}|�|���dS)z"Check that the expression is true.z%s is not trueNrRrSs   r�
assertTruezTestCase.assertTrue�sI���	-��%�%�c�+;�i��o�o�+M�N�N�C��'�'��,�,�,�	-�	-rc��|js|p|S|�|S	|�d|��S#t$r$t|���dt|����cYSwxYw)a�Honour the longMessage attribute when generating failure messages.
        If longMessage is False this means:
        * Use only an explicit message if it is provided
        * Otherwise use the standard message for the assert

        If longMessage is True:
        * Use the standard message
        * If an explicit message is provided, plus ' : ' and the explicit message
        Nz : )�longMessage�UnicodeDecodeErrorr)r"r�r�s   rr�zTestCase._formatMessage�s�����	&��%�+�%��;���	I�!,���S�S�1�1��!�	I�	I�	I�!*�;�!7�!7�!7�!7��3����H�H�H�H�	I���s��+A�Ac�d�t||��}	|�d||��d}S#d}wxYw)a=Fail unless an exception of class expected_exception is raised
           by the callable when invoked with specified positional and
           keyword arguments. If a different type of exception is
           raised, it will not be caught, and the test case will be
           deemed to have suffered an error, exactly as for an
           unexpected exception.

           If called with the callable and arguments omitted, will return a
           context object used like this::

                with self.assertRaises(SomeException):
                    do_something()

           An optional keyword argument 'msg' can be provided when assertRaises
           is used as a context object.

           The context manager keeps a reference to the exception as
           the 'exception' attribute. This allows you to inspect the
           exception after the assertion::

               with self.assertRaises(SomeException) as cm:
                   do_something()
               the_exception = cm.exception
               self.assertEqual(the_exception.error_code, 3)
        �assertRaisesN�r�r�)r"�expected_exceptionrWrX�contexts     rr\zTestCase.assertRaises�sB��4'�'9�4�@�@��	��>�>�.�$��?�?��G�G��d�G�N�N�N�Ns�+�/c�P�t||��}|�d||��S)a�Fail unless a warning of class warnClass is triggered
           by the callable when invoked with specified positional and
           keyword arguments.  If a different type of warning is
           triggered, it will not be handled: depending on the other
           warning filtering rules in effect, it might be silenced, printed
           out, or raised as an exception.

           If called with the callable and arguments omitted, will return a
           context object used like this::

                with self.assertWarns(SomeWarning):
                    do_something()

           An optional keyword argument 'msg' can be provided when assertWarns
           is used as a context object.

           The context manager keeps a reference to the first matching
           warning as the 'warning' attribute; similarly, the 'filename'
           and 'lineno' attributes give you information about the line
           of Python code from which the warning was triggered.
           This allows you to inspect the warning after the assertion::

               with self.assertWarns(SomeWarning) as cm:
                   do_something()
               the_warning = cm.warning
               self.assertEqual(the_warning.some_attribute, 147)
        �assertWarns�r�r�)r"�expected_warningrWrXr_s     rrazTestCase.assertWarnss*��8&�&6��=�=���~�~�m�T�6�:�:�:rc�,�ddlm}||||d���S)a�Fail unless a log message of level *level* or higher is emitted
        on *logger_name* or its children.  If omitted, *level* defaults to
        INFO and *logger* defaults to the root logger.

        This method must be used as a context manager, and will yield
        a recording object with two attributes: `output` and `records`.
        At the end of the context manager, the `output` attribute will
        be a list of the matching formatted log messages and the
        `records` attribute will be a list of the corresponding LogRecord
        objects.

        Example::

            with self.assertLogs('foo', level='INFO') as cm:
                logging.getLogger('foo').info('first message')
                logging.getLogger('foo.bar').error('second message')
            self.assertEqual(cm.output, ['INFO:foo:first message',
                                         'ERROR:foo.bar:second message'])
        r��_AssertLogsContextF��no_logs��_logrf�r"�logger�levelrfs    r�
assertLogszTestCase.assertLogs"s0��*	-�,�,�,�,�,�!�!�$���u�E�E�E�Erc�,�ddlm}||||d���S)z� Fail unless no log messages of level *level* or higher are emitted
        on *logger_name* or its children.

        This method must be used as a context manager.
        rreTrgrirks    r�assertNoLogszTestCase.assertNoLogs:s0��	-�,�,�,�,�,�!�!�$���t�D�D�D�Drc���t|��t|��urP|j�t|����}|�'t|t��rt||��}|S|jS)aGet a detailed comparison function for the types of the two args.

        Returns: A callable accepting (first, second, msg=None) that will
        raise a failure exception if first != second with a useful human
        readable error message for those types.
        )rHr��getrgr(r6�_baseAssertEqual)r"�first�second�asserters    r�_getAssertEqualityFunczTestCase._getAssertEqualityFuncCsl��"��;�;�$�v�,�,�&�&��0�4�4�T�%�[�[�A�A�H��#��h��,�,�7�&�t�X�6�6�H����$�$rc��||ks>dt||��z}|�||��}|�|���dS)z:The default assertEqual implementation, not type specific.�%s != %sN)r	r�r>)r"rtrur�r�s     rrszTestCase._baseAssertEqual]sP������$�';�E�6�'J�'J�J�K��%�%�c�;�7�7�C��'�'��,�,�,��rc�N�|�||��}||||���dS)z[Fail if the two objects are unequal as determined by the '=='
           operator.
        )r�N)rw)r"rtrur��assertion_funcs     r�assertEqualzTestCase.assertEqualds6���4�4�U�F�C�C����u�f�#�.�.�.�.�.�.rc��||ksJ|�|t|���dt|������}|�|���dS)zYFail if the two objects are equal as determined by the '!='
           operator.
        � == NrR)r"rtrur�s    r�assertNotEqualzTestCase.assertNotEqualkse�������%�%�c��5�9I�9I�9I�9I�:C�F�:K�:K�:K�,M�N�N�C��'�'��,�,�,��rc	���||krdS|�|�td���t||z
��}|�K||krdSt|���dt|���dt|���dt|���d�}nO|�d}t||��dkrdSt|���dt|���d|�d	t|���d�}|�||��}|�|���)
a'Fail if the two objects are unequal as determined by their
           difference rounded to the given number of decimal places
           (default 7) and comparing to zero, or by comparing that the
           difference between the two objects is more than the given
           delta.

           Note that decimal places (from zero) are usually not the same
           as significant digits (measured from the most significant digit).

           If the two objects compare equal then they will automatically
           compare almost equal.
        N� specify delta or places not bothz != � within � delta (� difference)�rz	 places (�rL�absr�roundr�r>�r"rtru�placesr��delta�diffr�s        r�assertAlmostEqualzTestCase.assertAlmostEqualts,���F�?�?��F����!3��>�?�?�?��5�6�>�"�"�����u�}�}����%� � � � ��&�!�!�!�!��%� � � � ��$�����	!�K�K��~����T�6�"�"�a�'�'����%� � � � ��&�!�!�!�!�����$�����	!�K�
�!�!�#�{�3�3���#�#�C�(�(�(rc	���|�|�td���t||z
��}|�Q||ks||krdSt|���dt|���dt|���dt|���d�}nE|�d}||kst||��dkrdSt|���dt|���d|�d	�}|�||��}|�|���)
a�Fail if the two objects are equal as determined by their
           difference rounded to the given number of decimal places
           (default 7) and comparing to zero, or by comparing that the
           difference between the two objects is less than the given delta.

           Note that decimal places (from zero) are usually not the same
           as significant digits (measured from the most significant digit).

           Objects that are equal automatically fail.
        Nr�r~r�r�r�r�rz placesr�r�s        r�assertNotAlmostEqualzTestCase.assertNotAlmostEqual�s�����!3��>�?�?�?��5�6�>�"�"�����V�O�O��������%� � � � ��&�!�!�!�!��%� � � � ��$�����	!�K�K��~����V�O�O��t�V�)<�)<��)A�)A���9B�5�9I�9I�9I�9I�9B�6�9J�9J�9J�9J�9?���A�K��!�!�#�{�3�3���#�#�C�(�(�(rc	��|�x|j}t||��s(|�d|�dt|�������t||��s(|�d|�dt|�������nd}d}	t	|��}n#t
tf$rd|z}YnwxYw|�-	t	|��}n#t
tf$rd|z}YnwxYw|���||krdSd|���ft||��zz}tt||����D]�}		||	}
n(#t
ttf$r|d	|	|fzz
}Yn�wxYw	||	}n(#t
ttf$r|d
|	|fzz
}YnQwxYw|
|kr|d|	ft|
|��zzz
}n+��||kr$|�"t|��t|��krdS||krS|d|||z
fzz
}	|d
|t||��fzz
}n�#t
ttf$r
|d||fzz
}Yn]wxYw||krS|d|||z
fzz
}	|d
|t||��fzz
}n'#t
ttf$r
|d||fzz
}YnwxYw|}dd�
tjt!j|�����t!j|���������z}
|�||
��}|�||��}|�|��dS)aAAn equality assertion for ordered sequences (like lists and tuples).

        For the purposes of this function, a valid ordered sequence type is one
        which can be indexed, has a length, and has an equality operator.

        Args:
            seq1: The first sequence to compare.
            seq2: The second sequence to compare.
            seq_type: The expected datatype of the sequences, or None if no
                    datatype should be enforced.
            msg: Optional message to use on failure instead of a list of
                    differences.
        NzFirst sequence is not a r�zSecond sequence is not a �sequencez(First %s has no length.    Non-sequence?z)Second %s has no length.    Non-sequence?z%ss differ: %s != %s
z(
Unable to index element %d of first %s
z)
Unable to index element %d of second %s
z#
First differing element %d:
%s
%s
z+
First %s contains %d additional elements.
zFirst extra element %d:
%s
z'Unable to index element %d of first %s
z,
Second %s contains %d additional elements.
z(Unable to index element %d of second %s
r	)r
rgr>r�lenrL�NotImplementedError�
capitalizer	�range�min�
IndexErrorrH�join�difflib�ndiff�pprint�pformat�
splitlines�_truncateMessager�rP)r"�seq1�seq2r��seq_type�
seq_type_name�	differing�len1�len2�i�item1�item2r��diffMsgs              r�assertSequenceEqualzTestCase.assertSequenceEqual�s�����$�-�M��d�H�-�-�
L��+�+�+�+8�=�=�)�D�/�/�/�-K�L�L�L��d�H�-�-�
L��+�+�+�+8�=�=�)�D�/�/�/�-K�L�L�L�
L�'�M��	�	#��t�9�9�D�D���.�/�	#�	#�	#�B�!�#�I�I�I�	#������
'��4�y�y�����2�3�
'�
'�
'�G�%�'�	�	�	�
'�������t�|�|���0�"�-�-�/�/�1�(��t�4�4�5�6�I��3�t�T�?�?�+�+�
�
��� ��G�E�E��!�:�/B�C�����"N�"#�]�!3�#4�5�I��E�E�����
� ��G�E�E��!�:�/B�C�����"O�"#�]�!3�#4�5�I��E�E�����
�E�>�>��"K�#$�$�)=�e�U�)K�)K�"K�#M�N�I��E�"�
�D�L�L�X�%5���J�J�$�t�*�*�,�,��F��d�{�{��+�.;�T�D�[�-I�J�K�	�K��"A�#'��4��:�)>�)>�"?�#@�A�I�I��!�:�/B�C�K�K�K��#2�59�=�4I�#J�K�I�I�I�K���������+�.;�T�D�[�-I�J�K�	�L��"A�#'��4��:�)>�)>�"?�#@�A�I�I��!�:�/B�C�L�L�L��#3�6:�M�5J�#K�L�I�I�I�L���� �������M�&�.��.�.�9�9�;�;� �.��.�.�9�9�;�;�
=�
=�>�>�>���+�+�K��A�A���!�!�#�{�3�3���	�	�#�����sl�B�B)�(B)�/B?�?C�C�/D8�8!E�E�!E*�*!F�F�3H�!H5�4H5�I*�*!J�
Jc�x�|j}|�t|��|kr||zS|tt|��zzSr0)�maxDiffr��DIFF_OMITTED)r"r�r��max_diffs    rr�zTestCase._truncateMessage's?���<����s�4�y�y�H�4�4��T�>�!��,��T���2�3�3rc�B�|�|||t���dS)aA list-specific equality assertion.

        Args:
            list1: The first list to compare.
            list2: The second list to compare.
            msg: Optional message to use on failure instead of a list of
                    differences.

        �r�N)r�r�)r"�list1�list2r�s    rr�zTestCase.assertListEqual-s'��	
� � ���s�T� �B�B�B�B�Brc�B�|�|||t���dS)aA tuple-specific equality assertion.

        Args:
            tuple1: The first tuple to compare.
            tuple2: The second tuple to compare.
            msg: Optional message to use on failure instead of a list of
                    differences.
        r�N)r�r�)r"�tuple1�tuple2r�s    rr�zTestCase.assertTupleEqual9s'��	
� � ����u� �E�E�E�E�Erc�J�	|�|��}nY#t$r"}|�d|z��Yd}~n2d}~wt$r"}|�d|z��Yd}~nd}~wwxYw	|�|��}nY#t$r"}|�d|z��Yd}~n2d}~wt$r"}|�d|z��Yd}~nd}~wwxYw|s|sdSg}|r<|�d��|D]$}|�t|�����%|r<|�d��|D]$}|�t|�����%d�|��}	|�|�||	����dS)a�A set-specific equality assertion.

        Args:
            set1: The first set to compare.
            set2: The second set to compare.
            msg: Optional message to use on failure instead of a list of
                    differences.

        assertSetEqual uses ducktyping to support different types of sets, and
        is optimized for sets specifically (parameters must support a
        difference method).
        z/invalid type when attempting set difference: %sNz2first argument does not support set difference: %sz3second argument does not support set difference: %sz*Items in the first set but not the second:z*Items in the second set but not the first:r	)�
differencerLrPrKrU�reprr�r�)
r"�set1�set2r��difference1r.�difference2�lines�itemr�s
          rr�zTestCase.assertSetEqualDs&��	P��/�/�$�/�/�K�K���	M�	M�	M��I�I�G�!�K�L�L�L�L�L�L�L�L������	P�	P�	P��I�I�J�Q�N�O�O�O�O�O�O�O�O�����	P����	Q��/�/�$�/�/�K�K���	M�	M�	M��I�I�G�!�K�L�L�L�L�L�L�L�L������	Q�	Q�	Q��I�I�K�a�O�P�P�P�P�P�P�P�P�����	Q�����	�{�	��F����	)��L�L�E�F�F�F�#�
)�
)�����T�$�Z�Z�(�(�(�(��	)��L�L�E�F�F�F�#�
)�
)�����T�$�Z�Z�(�(�(�(��i�i��&�&���	�	�$�%�%�c�;�7�7�8�8�8�8�8sB��
A.�?�
A.�A)�)A.�2B�
C�B/�/
C�<C�Cc��||vrLt|���dt|����}|�|�||����dSdS)zDJust like self.assertTrue(a in b), but with a nicer default message.� not found in N�rrPr��r"�member�	containerr�r�s     r�assertInzTestCase.assertInosd����"�"�2;�F�2C�2C�2C�2C�2;�I�2F�2F�2F�H�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<�#�"rc��||vrLt|���dt|����}|�|�||����dSdS)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nr�r�s     r�assertNotInzTestCase.assertNotInvsd���Y���;D�V�;L�;L�;L�;L�8A�)�8L�8L�8L�N�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��rc��||urLt|���dt|����}|�|�||����dSdS)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nr��r"�expr1�expr2r�r�s     r�assertIszTestCase.assertIs}sc������,5�e�,<�,<�,<�,<�-6�u�-=�-=�-=�?�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��rc��||ur=dt|����}|�|�||����dSdS)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nr�r�s     r�assertIsNotzTestCase.assertIsNot�sO���E�>�>�>�:C�E�:J�:J�:J�L�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��>rc	��|�|td��|�|td��||kr�dt||��z}dd�t	jt
j|�����t
j|���������z}|�	||��}|�
|�||����dSdS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryryr	)�assertIsInstancer�r	r�r�r�r�r�r�r�rPr�)r"�d1�d2r�r�r�s      rr�zTestCase.assertDictEqual�s������b�$�(L�M�M�M����b�$�(M�N�N�N�
��8�8�$�';�B��'C�'C�C�K��4�9�9�W�]�!�>�"�-�-�8�8�:�:�!�>�"�-�-�8�8�:�:�&<�&<�=�=�=�D��/�/��T�B�B�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<�
�8rc�H�tjdt��g}g}|���D]u\}}||vr|�|���|||krJ|�t|���dt|���dt||�������v|s|sdSd}|r"dd�d�|D����z}|r"|r|d	z
}|d
d�|��zz
}|�|�||����dS)z2Checks whether dictionary is a superset of subset.z&assertDictContainsSubset is deprecatedz, expected: z
, actual: NrnzMissing: %s�,c3�4K�|]}t|��V��dSr0)r)r~r�s  rr�z4TestCase.assertDictContainsSubset.<locals>.<genexpr>�s8����3=�3=�A�9�Q�<�<�3=�3=�3=�3=�3=�3=rz; zMismatched values: %s)	r7r8r4�itemsrUrr�rPr�)	r"�subset�
dictionaryr��missing�
mismatched�key�valuer�s	         r�assertDictContainsSubsetz!TestCase.assertDictContainsSubset�sz���
�>�(�	*�	*�	*����
� �,�,�.�.�	@�	@�J�C���*�$�$����s�#�#�#�#��*�S�/�)�)��!�!�#,�S�>�>�>�>�9�U�3C�3C�3C�3C�#,�Z��_�#=�#=�#=�#?�@�@�@���	�:�	��F����	=�'�#�(�(�3=�3=�4;�3=�3=�3=�+=�+=�=�K��	J��
$��t�#���2�S�X�X�j�5I�5I�I�I�K��	�	�$�%�%�c�;�7�7�8�8�8�8�8rc���t|��t|��}}	tj|��}tj|��}||krdSt||��}n #t$rt||��}YnwxYw|rfd}d�|D��}d�|��}	|�||	��}|�||��}|�	|��dSdS)a[Asserts that two iterables have the same elements, the same number of
        times, without regard to order.

            self.assertEqual(Counter(list(first)),
                             Counter(list(second)))

         Example:
            - [0, 1, 1] and [1, 0, 1] compare equal.
            - [0, 0, 1] and [0, 1] compare unequal.

        NzElement counts were not equal:
c��g|]}d|z��S)z First has %d, Second has %d:  %rr)r~r�s  r�
<listcomp>z-TestCase.assertCountEqual.<locals>.<listcomp>�s��W�W�W�4�7�$�>�W�W�Wrr	)
r��collections�CounterrrLrr�r�r�rP)
r"rtrur��	first_seq�
second_seq�differencesr�r�r�s
          r�assertCountEqualzTestCase.assertCountEqual�s��!%�U���T�&�\�\�:�	�		F��'�	�2�2�E� �(��4�4�F�
������.�y�*�E�E�K�K��
�	I�	I�	I�1�)�Z�H�H�K�K�K�	I�����	�<�K�W�W�;�W�W�W�E��i�i��&�&�G��/�/��W�E�E�K��%�%�c�;�7�7�C��I�I�c�N�N�N�N�N�
	�	s�(A!�!A>�=A>c���|�|td��|�|td��||k�r*t|��|jkst|��|jkr|�|||��|�d���}|�d���}t|��dkr%|�d��|kr|dzg}|dzg}dt||��z}dd	�tj
||����z}|�||��}|�|�
||����d
Sd
S)z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringT)�keependsrz
r	ryrnN)r�r(r��_diffThresholdrsr�r
r	r�r�r�r�rPr�)r"rtrur��
firstlines�secondlinesr�r�s        rr�zTestCase.assertMultiLineEqual�sa�����e�S�*J�K�K�K����f�c�+L�M�M�M��F�?�?��E�
�
�T�0�0�0��F���d�1�1�1��%�%�e�V�S�9�9�9��)�)�4�)�8�8�J� �+�+�T�+�:�:�K��:���!�#�#����F�(;�(;�u�(D�(D�#�d�l�^�
�%��}�o��$�';�E�6�'J�'J�J�K��"�'�'�'�-�
�K�"H�"H�I�I�I�D��/�/��T�B�B�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��?rc��||ksLt|���dt|����}|�|�||����dSdS)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nr��r"�a�br�r�s     r�
assertLesszTestCase.assertLess�sV���1�u�u�3<�Q�<�<�<�<��1����N�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��urc��||ksLt|���dt|����}|�|�||����dSdS)zDJust like self.assertTrue(a <= b), but with a nicer default message.z not less than or equal to Nr�r�s     r�assertLessEqualzTestCase.assertLessEqual�sW���A�v�v�?H��|�|�|�|�Y�WX�\�\�\�Z�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��vrc��||ksLt|���dt|����}|�|�||����dSdS)zCJust like self.assertTrue(a > b), but with a nicer default message.z not greater than Nr�r�s     r�
assertGreaterzTestCase.assertGreater�sV���1�u�u�6?��l�l�l�l�I�a�L�L�L�Q�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��urc��||ksLt|���dt|����}|�|�||����dSdS)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to Nr�r�s     r�assertGreaterEqualzTestCase.assertGreaterEqual�s[���A�v�v�BK�A�,�,�,�,�PY�Z[�P\�P\�P\�]�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��vrc��|�=t|���d�}|�|�||����dSdS)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Noner��r"rCr�r�s    r�assertIsNonezTestCase.assertIsNone�sH���?�.7��n�n�n�n�>�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��?rc�d�|�-d}|�|�||����dSdS)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rPr�r�s    r�assertIsNotNonezTestCase.assertIsNotNones;���;�-�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<��;rc��t||��s?t|���d|��}|�|�||����dSdS)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer
        default message.z is not an instance of N�rgrrPr��r"rCrOr�r�s     rr�zTestCase.assertIsInstances^���#�s�#�#�	=�;D�S�>�>�>�>�3�3�O�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<�	=�	=rc��t||��r?t|���d|��}|�|�||����dSdS)z,Included for symmetry with assertIsInstance.z is an instance of Nr�r�s     r�assertNotIsInstancezTestCase.assertNotIsInstances\���c�3���	=�7@��~�~�~�~�s�s�K�K��I�I�d�)�)�#�{�;�;�<�<�<�<�<�	=�	=rc�R�t|||��}|�d||��S)aAsserts that the message in a raised exception matches a regex.

        Args:
            expected_exception: Exception class expected to be raised.
            expected_regex: Regex (re.Pattern object or string) expected
                    to be found in error message.
            args: Function to be called and extra positional args.
            kwargs: Extra kwargs.
            msg: Optional message used in case of failure. Can only be used
                    when assertRaisesRegex is used as a context manager.
        �assertRaisesRegexr])r"r^r�rWrXr_s      rrzTestCase.assertRaisesRegexs-��'�'9�4��P�P���~�~�1�4��@�@�@rc�R�t|||��}|�d||��S)a�Asserts that the message in a triggered warning matches a regexp.
        Basic functioning is similar to assertWarns() with the addition
        that only warnings whose messages also match the regular expression
        are considered successful matches.

        Args:
            expected_warning: Warning class expected to be triggered.
            expected_regex: Regex (re.Pattern object or string) expected
                    to be found in error message.
            args: Function to be called and extra positional args.
            kwargs: Extra kwargs.
            msg: Optional message used in case of failure. Can only be used
                    when assertWarnsRegex is used as a context manager.
        �assertWarnsRegexrb)r"rcr�rWrXr_s      rrzTestCase.assertWarnsRegex(s-�� &�&6��n�M�M���~�~�0�$��?�?�?rc��t|ttf��rtj|��}|�|��s8d|j�d|��}|�||��}|�|���dS)z=Fail the test unless the text matches the regular expression.zRegex didn't match: r�N)	rgr(�bytesr�r�r�r�r�r>)r"�textr�r�r�s     r�assertRegexzTestCase.assertRegex;s����n�s�E�l�3�3�	8��Z��7�7�N��$�$�T�*�*�	-�	-��&�&�&���.�K��%�%�c�;�7�7�C��'�'��,�,�,�	-�	-rc�b�t|ttf��rtj|��}|�|��}|rgd||���|�����d|j�d|��}|�	||��}|�
|���dS)z9Fail the test if the text matches the regular expression.zRegex matched: z	 matches z in N)rgr(rr�r�r��start�endr�r�r>)r"r�unexpected_regexr��matchr�s      r�assertNotRegexzTestCase.assertNotRegexGs����&��e��5�5�	<�!�z�*:�;�;�� �'�'��-�-���	-�	-��U�[�[�]�]�U�Y�Y�[�[�0�1�1�1� �(�(�(����K�
�%�%�c�;�7�7�C��'�'��,�,�,�	-�	-rc����fd�}|S)Nc�z��tjd��j��td���|i|��S)NzPlease use {0} instead.r5)r7r8r�r
r4)rWrX�
original_funcs  �r�deprecated_funcz,TestCase._deprecate.<locals>.deprecated_funcWsG����M�)�0�0��1G�H�H�"�A�
'�
'�
'�!�=�$�1�&�1�1�1rr)rrs` r�
_deprecatezTestCase._deprecateVs$���	2�	2�	2�	2�	2�
�r)r�r0)NN�NNN)er
rrr�AssertionErrorr>rYr�r�r�r#r�r�r�r�r�r�r�r�r�rrrrrrrrr!r1r2�_subtest_msg_sentinelr,r+r.r0r6r8r:rCr@rGrJrLrNrPrUrWr�r\rarnrprwrsr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr�failUnlessEqual�assertEquals�failIfEqual�assertNotEquals�failUnlessAlmostEqual�assertAlmostEquals�failIfAlmostEqual�assertNotAlmostEquals�
failUnless�assert_�failUnlessRaises�failIf�assertRaisesRegexp�assertRegexpMatches�assertNotRegexpMatches�
__classcell__�r�s@rr�r�Xs����������@&���K��G��N�3�3�3�3�3�>�>�>�>�@
6�
6�
6�8�8�8�3�3�3��=�=��[�=�
�7�7��[�7�
�
�
�
�
�
��V�V��[�V��a�a��[�a����#�#�#�C�C�C�J�J�J�=�=�=�8�8�8�e�e�e�@�@�@���/�#�#�#���#�</�/�/�
'�
'�
'����U�U�U�
���"�"�"�=�=�=�=�~����	?�	?��[�	?�'�'�'�9�9�9�"���)�)�)�)�-�-�-�-�-�-�-�-�I�I�I�*���B;�;�;�>F�F�F�F�0E�E�E�E�%�%�%�4-�-�-�-�/�/�/�/�-�-�-�-�AE� $�+)�+)�+)�+)�ZDH�#'�!)�!)�!)�!)�Fa�a�a�a�F4�4�4�
C�
C�
C�
C�	F�	F�	F�	F�)9�)9�)9�)9�V=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�
=�
=�
=�
=�9�9�9�9�:����@=�=�=�=�(=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�A�A�A� @�@�@�&
-�
-�
-�
-�-�-�-�-����&0�Z��%<�%<�<�O�l�$.�J�~�$>�$>�>�K�/�1;��<M�1N�1N�N��.�0:�
�;O�0P�0P�P��-�%�:�j�1�1�1�J��!�z�,�/�/��
�Z��
$�
$�F�#��$5�6�6��$�*�[�1�1��'�Z��7�7�����rr�c�Z��eZdZdZd
�fd�	Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
�xZS)�FunctionTestCaseaIA test case that wraps a test function.

    This is useful for slipping pre-existing test functions into the
    unittest framework. Optionally, set-up and tidy-up functions can be
    supplied. As with TestCase, the tidy-up ('tearDown') function will
    always be called if the set-up ('setUp') function ran successfully.
    Nc���tt|�����||_||_||_||_dSr0)r�r)r#�
_setUpFunc�
_tearDownFunc�	_testFunc�_description)r"�testFuncr�r��descriptionr�s     �rr#zFunctionTestCase.__init__usD���
���%�%�.�.�0�0�0����%���!���'����rc�@�|j�|���dSdSr0)r+r�s rr�zFunctionTestCase.setUp|s(���?�&��O�O������'�&rc�@�|j�|���dSdSr0)r,r�s rr�zFunctionTestCase.tearDown�s+����)���� � � � � �*�)rc�.�|���dSr0)r-r�s rr�zFunctionTestCase.runTest�s���������rc��|jjSr0)r-r
r�s rrzFunctionTestCase.id�s
���~�&�&rc��t||j��stS|j|jko/|j|jko|j|jko|j|jkSr0)rgr�rr+r,r-r.rs  rrzFunctionTestCase.__eq__�sg���%���0�0�	"�!�!���%�"2�2�7��!�U�%8�8�7��~���0�7�� �E�$6�6�	7rc�l�tt|��|j|j|j|jf��Sr0)rrHr+r,r-r.r�s rrzFunctionTestCase.__hash__�s4���T�$�Z�Z���$�2D��^�T�%6�8�9�9�	9rc�J�t|j���d|jj�d�S)Nrr)rr�r-r
r�s rrzFunctionTestCase.__str__�s-��$�T�^�4�4�4�4� �N�3�3�3�5�	5rc�B�dt|j���d|j�d�S)Nrz tec=r )rr�r-r�s rr!zFunctionTestCase.__repr__�s*��� (��� 8� 8� 8� 8�%)�^�^�^�5�	5rc��|j�|jS|jj}|r-|�d��d���pdS)Nr	r)r.r-rrr
rs  rrz!FunctionTestCase.shortDescription�sI����(��$�$��n�$���1�s�y�y����q�)�/�/�1�1�9�T�9rr)r
rrrr#r�r�r�rrrrr!rr&r's@rr)r)ls����������(�(�(�(�(�(����!�!�!����'�'�'�7�7�7�9�9�9�5�5�5�5�5�5�:�:�:�:�:�:�:rr)c�<��eZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z�xZ	S)r%c���t�����||_||_||_|j|_dSr0)r�r#�_messager%r#r>)r"r%r�r#r�s    �rr#z_SubTest.__init__�s?���
����������
�"������ )� :����rc� �td���)Nzsubtests cannot be run directly)r�r�s rr�z_SubTest.runTest�s��!�"C�D�D�Drc�t�g}|jtur-|�d�|j����|jr^d�d�|j���D����}|�d�|����d�|��pdS)Nz[{}]z, c3�HK�|]\}}d�||��V��dS)z{}={!r}N)r�)r~r�r�s   rr�z+_SubTest._subDescription.<locals>.<genexpr>�sJ����$3�$3��Q��� � ��A�&�&�$3�$3�$3�$3�$3�$3rz({})� z(<subtest>))r<rrUr�r#r�r�)r"�parts�params_descs   r�_subDescriptionz_SubTest._subDescription�s������=� 5�5�5��L�L����t�}�5�5�6�6�6��;�	5��)�)�$3�$3�"�k�/�/�1�1�$3�$3�$3�3�3�K�
�L�L����{�3�3�4�4�4��x�x����/�-�/rc��d�|j���|�����S�Nz{} {})r�r%rrCr�s rrz_SubTest.id�s0���~�~�d�n�/�/�1�1�4�3G�3G�3I�3I�J�J�Jrc�4�|j���S)zlReturns a one-line description of the subtest, or None if no
        description has been provided.
        )r%rr�s rrz_SubTest.shortDescription�s���~�.�.�0�0�0rc�\�d�|j|�����SrE)r�r%rCr�s rrz_SubTest.__str__�s$���~�~�d�n�d�.B�.B�.D�.D�E�E�Er)
r
rrr#r�rCrrrr&r's@rr%r%�s��������;�;�;�;�;�E�E�E�	0�	0�	0�K�K�K�1�1�1�F�F�F�F�F�F�Frr%)2rr)rhr�r�r�r7r�r1r�rornr�utilrrrrr	�
__unittest�objectrr�r^rrrrr'r+rDrRrTrYr[rarqrvrxr!r}r�r�r�r��ChainMapr�r�r)r%rrr�<module>rLs�����
�
�
�
���������
�
�
�
�	�	�	�	���������������������������?�?�?�?�?�?�?�?�?�?�?�?�?�?��
������7�������y���������)����
���������&8�&8�&8�&8�&8�v�&8�&8�&8�R%�%�%�,�,�,���������6�6�6�
0�0�0�

�
�
� ���(���������I�I�I�
3�3�3�3�3�3�3�3�'�'�'�'�'�3�'�'�'�T$8�$8�$8�$8�$8�3�$8�$8�$8�N1D�1D�1D�1D�1D�2�1D�1D�1D�h�����{�+����P8�P8�P8�P8�P8�v�P8�P8�P8�h 7:�7:�7:�7:�7:�x�7:�7:�7:�t!F�!F�!F�!F�!F�x�!F�!F�!F�!F�!Fr