%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/test/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/test/__pycache__/test_rebuild.cpython-312.pyc

�

Ϫ�f����ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZejZGd�d	�aGd
�dt�ZGd�d
�ZGd�dee�aGd�d�ZdaGd�de
�ZGd�de
�Zy)�)�annotationsN)�NoReturn��rebuild)�TestCase�)�crash_test_dummyc��eZdZy)�FooN��__name__�
__module__�__qualname__���;/usr/lib/python3/dist-packages/twisted/test/test_rebuild.pyrr���rrc��eZdZy)�BarNrrrrrrrrrc��eZdZy)�BazNrrrrrrrrrc��eZdZy)�BuzNrrrrrrrrrc� �eZdZdZdd�Zdd�Zy)�HashRaisesRuntimeErrorz�
    Things that don't hash (raise an Exception) should be ignored by the
    rebuilder.

    @ivar hashCalled: C{bool} set to True when __hash__ is called.
    c��d|_y)NF)�
hashCalled��selfs r�__init__zHashRaisesRuntimeError.__init__+s	����rc�&�d|_td��)NTznot a TypeError!)r�RuntimeErrorrs r�__hash__zHashRaisesRuntimeError.__hash__.s������-�.�.rN��return�None)r%r)r
rr�__doc__r r#rrrrr#s��� �/rrc�X�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zy)
�RebuildTestszH
    Simple testcase for rebuilding, to at least exercise the code.
    c���|j�|_tj|j�tjj|jd�|_tj|j�ttjj|jd�d�j�tjjd|j�y)N�twisted_rebuild_fakelibz__init__.py�wr)�mktemp�libPath�os�mkdir�path�join�fakelibPath�open�close�sys�insertrs r�setUpzRebuildTests.setUp<s����{�{�}���
��������7�7�<�<����6O�P���
����!�!�"��R�W�W�\�\�$�*�*�M�
:�C�@�F�F�H�������4�<�<�(rc�V�tjj|j�y�N)r6r1�remover.rs r�tearDownzRebuildTests.tearDownDs����������%rc�L�ddl}ddl}ddlm}|j	|t
d�tjj|jd��ddl
m}|j�}|j�}|j�}|j|j!�d�|j#d�|j	|t
d�tjj|jd��t%j$|�|j�}|j|j'�d	�|j|j'�d	�|j|j!�d
�|j|j!�d�y)Nr)�sibpathzmyrebuilder1.pyzmyrebuilder.py)�myrebuilder�ag�������?zmyrebuilder2.py�c�d�b)�shutil�time�twisted.python.utilr>�copyfile�__file__r/r1r2r3r+r?�A�B�Inherit�assertEqualr@�sleeprrC)	rrDrEr>r?r@rC�i�b2s	         r�test_FileRebuildzRebuildTests.test_FileRebuildGs*����/�����H�/�0��G�G�L�L��)�)�+;�<�	
�	
�
�M�M�O���M�M�O�����!����������$�	
�
�
�3������H�/�0��G�G�L�L��)�)�+;�<�	
�	����$�
�]�]�_����������%���������$���������$���������$rc� �tjd�}tjtd��|j�|j	|j
tj�|j	ttj�y)z1
        Rebuilding an unchanged module.
        r@F)�doLogN)r	�Xr�dorL�	__class__�f�foo)r�xs  r�test_RebuildzRebuildTests.test_Rebuildhs^��
���s�#�����(��6�	����������&6�&8�&8�9�����,�0�0�1rc�R�tj�}|jtjtj�|jtj�t
jtd�|jtj�}|j�|j|jtj�ddl
m}|jt|jtjtjtj�y)Nr)�
components)r	�
XComponent�
setAdapter�IX�XA�getComponentr�methodrLrU�twisted.pythonr[�assertRaises�
ValueError�registerAdapterrS)rrX�newComponentr[s    r�test_ComponentInteractionz&RebuildTests.test_ComponentInteractionys����'�'�)��	���%�(�(�*:�*=�*=�>�	���'�*�*�+����(�!�,��~�~�&6�&9�&9�:����������/�/�1A�1D�1D�E�	.������&�&����������	
rc���t�}Gd�d�aGd�dtt�at	j
|�t
|d�sJd��t
|d�sJd��y)	Nc��eZdZdd�Zy)rc��y�z.
                Dummy method
                Nrrs rrWzFoo.foo���rNr$)r
rrrWrrrrr����
rrc��eZdZdZy)r�
N)r
rrrXrrrrr�s���ArrrWz"Missing method on rebuilt instancerXz+Missing class attribute on rebuilt instance)rrrrr�updateInstance�hasattr)rrCs  r�test_UpdateInstancez RebuildTests.test_UpdateInstance�s]��
�E��	�	�	�#�s�	�	���q�!��q�%� �F�"F�F� ��q�#��M� M�M�rc�T�ddlm}ddlm}|j|j
�y)Nrr)�banana)rbr�twisted.spreadrt�latestClass�Banana)rrrts   r�test_BananaInteractionz#RebuildTests.test_BananaInteraction�s��*�)�����F�M�M�*rc��t�add�}|j|�tjt�|j	tj
�y)z~
        Rebuilding something that has a __hash__ that raises a non-TypeError
        shouldn't cause rebuild to die.
        c��dayr:)�unhashableObjectrrr�_cleanupz1RebuildTests.test_hashException.<locals>._cleanup�s��#�rNr$)rr{�
addCleanupr�
assertTruer)rr|s  r�test_hashExceptionzRebuildTests.test_hashException�s?��2�3��	$�	
����!����� ����(�3�3�4rc��ddlm}ddlm}Gd�d|�}|�}|j	�|j|j
��|jt�}|jtt�t|��|j||j|��|j|j|j|j��|j|j|j|j��|j||j|��dd�}|j||j|��y)	z5
        L{twisted.python.rebuild.Sensitive}
        rr)�	Sensitivec��eZdZdd�Zy)�2RebuildTests.test_Sensitive.<locals>.TestSensitivec��yrkrrs r�test_methodz>RebuildTests.test_Sensitive.<locals>.TestSensitive.test_method�rlrNr$)r
rrr�rrr�
TestSensitiver��rmrr�c��y)z&
            Dummy method
            Nrrrr�
myFunctionz/RebuildTests.test_Sensitive.<locals>.myFunction�rlrNr$)
rbr�twisted.python.rebuildr��rebuildUpToDate�assertFalse�needRebuildUpdaterv�	ExceptionrL�repr�latestVersionOfr�)rrr�r��
testSensitive�newExceptionr�s       r�test_SensitivezRebuildTests.test_Sensitive�s#��	+�4�	�I�	�&��
��%�%�'�����8�8�:�;�+�w�*�*�9�5������i��$�|�*<�=�����}�'D�'D�\�'R�S�	
����%�%��)�)�-�*C�*C�D�	
�
	
����%�%��)�)�-�*C�*C�D�	
�
	
����
�(E�(E�m�(T�U�	�	
����]�%B�%B�:�%N�OrNr$)
r
rrr'r8r<rPrYrgrrrxrr�rrrr)r)7s7���)�&�%�B2�"
�,N�$+�5� )Prr)c�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)�
NewStyleTestszB
    Tests for rebuilding new-style classes of various sorts.
    c�r�tjd�|_|jtjd<y�N�whipping)�types�
ModuleType�mr6�modulesrs rr8zNewStyleTests.setUp�s&���!�!�*�-���"&�&�&����J�rc�*�tjd=|`yr�)r6r�r�rs rr<zNewStyleTests.tearDown�s���K�K�
�#��Frc��d}t||jj�|jj�}d|_t||jj�tj|�|j|jd�|jt|�|jj�y)zF
        Try to rebuild a new style class with slots defined.
        z*class SlottedClass:
    __slots__ = ['a']
�N)
�execr��__dict__�SlottedClassr@rrprL�assertIs�type�r�classDefinition�insts   r�
test_slotszNewStyleTests.test_slots�s���L���_�d�f�f�o�o�.��v�v�"�"�$������_�d�f�f�o�o�.����t�$��������#��
�
�d�4�j�$�&�&�"5�"5�6rc��d}t||jj�|jj�}|j	d�t||jj�tj|�|j|dd�|jt|�|jj�y)z6
        Try to rebuild a base type subclass.
        z#class ListSubclass(list):
    pass
�rN)
r�r�r��ListSubclass�appendrrprLr�r�r�s   r�test_typeSubclasszNewStyleTests.test_typeSubclass�s���E���_�d�f�f�o�o�.��v�v�"�"�$�����A���_�d�f�f�o�o�.����t�$�����a��!�$��
�
�d�4�j�$�&�&�"5�"5�6rNr$)r
rrr'r8r<r�r�rrrr�r��s���)��7�7rr�)�
__future__rr/r6r��typingrrbr�twisted.trial.unittestr�r	rWrVrrrrrr{r)r�rrr�<module>r�s���#�	�
���"�+������	�	�	�#�	�	�	�	�#�s�	�
/�
/�"��iP�8�iP�X'7�H�'7r

Zerion Mini Shell 1.0