Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/__pycache__/test_finalization.cpython-312.opt-2.pyc

�

'Μg�:��`�	ddlZddlZddlZddlZ	ddlmZ	ddlmZddlm	Z	Gd�d�Z
Gd	�d
e
�ZeGd�de
��ZeGd
�de
��Z
Gd�de�ZGd�de�ZGd�d�ZGd�deej"�ZGd�d�ZGd�dee�ZGd�dee�ZGd�dee�ZGd�d eej"�ZGd!�d"�ZGd#�d$ee�ZGd%�d&ee�ZGd'�d(ee�ZGd)�d*eej"�ZGd+�d,e�ZeGd-�d.e��ZeGd/�d0e��ZeGd1�d2ee��Z e	jBGd3�d4eej"��Z"e#d5k(rejH�yy#e$rd�ZY���wxYw#e$rd�ZY���wxYw)6�N)�with_tp_delc�$�Gd�dt�}|S)Nc��eZdZd�Zy)�with_tp_del.<locals>.Cc��td��)Nzrequires _testcapi.with_tp_del��	TypeError��cls�args�kwargss   �3/usr/local/lib/python3.12/test/test_finalization.py�__new__zwith_tp_del.<locals>.C.__new__s��� @�A�A�N��__name__�
__module__�__qualname__r�rr�Crs��
Brr)�object�rrs  rrr
s��	B��	B��r)�
without_gcc��Gd�d�}|S)Nc��eZdZd�Zy)�without_gc.<locals>.Cc��td��)Nzrequires _testcapi.without_gcrr
s   rrzwithout_gc.<locals>.C.__new__s��� ?�@�@rNrrrrrrs��
Arrrrs  rrrs��	A�	A��r)�supportc�v�eZdZ	gZgZgZgZdZdZe	d��Z
e	ejd���Z
d�Zd�Zd�Zy)	�NonGCSimpleBaseFrc�8�|jj�|jj�tjj�tj
�|jj�|jj�y�N)�	survivors�clear�errors�gc�garbage�collect�	del_calls�tp_del_calls�rs r�_cleanupzNonGCSimpleBase._cleanup.s]���
�
�����
�
����
�
�
����
�
�
���
�
��������� rc#�K�	tj�5|jj�|jj�dt
_	d��|jr|jd�	dt
_|j�	ddd�y#dt
_|j�wxYw#1swYyxYw�w)NFrT)	r�
disable_gcr)r$r*r �	_cleaningr%r,r+s r�testzNonGCSimpleBase.test7s�����	��
�
�
!��M�M���!����"�"�$�(-�O�%�
���:�:��*�*�Q�-�'��-1��)�����"�
!��-1��)������"�
!�s5�C
�AB>�B�9B>�	C
�B;�;B>�>C�C
c��yr"r��selfs r�check_sanityzNonGCSimpleBase.check_sanityI���	rc��		|jsE|jjt|��|j	�|j�yy#t$r%}|jj|�Yd}~yd}~wwxYwr")r/r)�append�idr4�side_effect�	Exceptionr%�r3�es  r�__del__zNonGCSimpleBase.__del__Nsm��	�	"��>�>����%�%�b��h�/��!�!�#�� � �"�"���	"��K�K���q�!�!��	"���AA�	B�A>�>Bc��yr"rr2s rr9zNonGCSimpleBase.side_effect[r5rN)rrrr#r)r*r%r/�	__slots__�classmethodr,�
contextlib�contextmanagerr0r4r=r9rrrr r sj���
�I��I��L�
�F��I��I��!��!��������� �
"�rr c��eZdZd�Zd�Zy)�
SimpleBasec�$�t|�|_yr")r8�id_r2s r�__init__zSimpleBase.__init__cs
���d�8��rc��yr"rr2s rr4zSimpleBase.check_sanityfs�rN)rrrrHr4rrrrErEas���$rrEc��eZdZdZy)�NonGCrN)rrrr@rrrrKrKjs���IrrKc��eZdZdZd�Zy)�NonGCResurrectorrc�<�	|jj|�yr"�r#r7r2s rr9zNonGCResurrector.side_effectr���	�	
�����d�#rN)rrrr@r9rrrrMrMns���I�$rrMc��eZdZy)�SimpleN�rrrrrrrRrRx���rrRc��eZdZd�Zy)�SimpleResurrectorc�<�	|jj|�yr"rOr2s rr9zSimpleResurrector.side_effect~rPrN�rrrr9rrrrVrV|s��$rrVc�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�TestBasec�Z�tjdd|_gtjddyr")r&r'�old_garbager2s r�setUpzTestBase.setUp�s���:�:�a�=�����
�
�1�
rc��	|jtjg�|`tj�y#|`tj�wxYwr")�assertEqualr&r'r\r(r2s r�tearDownzTestBase.tearDown�s=��	����R�Z�Z��,�� ��J�J�L��� ��J�J�L�s	� 9�Ac�h�|jttj�t|��yr")r_�sortedrEr)�r3�idss  r�assert_del_callszTestBase.assert_del_calls�s!������
� 4� 4�5�v�c�{�Crc�h�|jttj�t|��yr")r_rbrEr*rcs  r�assert_tp_del_callszTestBase.assert_tp_del_calls�s!������
� 7� 7�8�&��+�Frc�v�|jtd�tjD��t|��y)Nc3�2K�|]}t|����y�wr"�r8��.0�xs  r�	<genexpr>z,TestBase.assert_survivors.<locals>.<genexpr>�s����D�/C�!��1��/C���)r_rbrEr#rcs  r�assert_survivorszTestBase.assert_survivors�s'������D�z�/C�/C�D�D�f�S�k�Rrc�v�|jtd�tjD��t|��y)Nc3�2K�|]}t|����y�wr"rjrks  rrnz*TestBase.assert_garbage.<locals>.<genexpr>�s����:�z�!��1��z�ro)r_rbr&r'rcs  r�assert_garbagezTestBase.assert_garbage�s%������:�r�z�z�:�:�F�3�K�Hrc�@�tjj�yr")rEr#r$r2s r�clear_survivorszTestBase.clear_survivors�s�����"�"�$rN)
rrrr]r`rergrprsrurrrrZrZ�s)����D�G�S�I�%rrZc�b�eZdZ	d�Zd�Zejd��Zejd��Zy)�SimpleFinalizationTestc��tj�5t�}t|�g}t	j
|�}~t
j�|j|�|jg�|j|�d�t
j�|j|�|jg�ddd�y#1swYyxYwr")rEr0rRr8�weakref�refr&r(rerp�assertIs�r3�srd�wrs    r�test_simplez"SimpleFinalizationTest.test_simple�s���
�_�_�
���A��a�5�'�C����Q��B���J�J�L��!�!�#�&��!�!�"�%��M�M�"�$��%��J�J�L��!�!�#�&��!�!�"�%��
�
���B0C�Cc��tj�5t�}t|�g}t	j
|�}~t
j�|j|�|j|�|j|�d�|j�t
j�|j|�|jg�ddd�|j�d�y#1swY�!xYwr")
rEr0rVr8ryrzr&r(rerp�assertIsNotrur{r|s    r�test_simple_resurrectz,SimpleFinalizationTest.test_simple_resurrect�s���
�_�_�
�!�#�A��a�5�'�C����Q��B���J�J�L��!�!�#�&��!�!�#�&����R�T�4�(�� � �"��J�J�L��!�!�#�&��!�!�"�%��	
�
�
�b�d�D�!��
�s�CC5�5C>c��tj�5t�}|jt	j
|��t
|�g}~t	j�|j|�|jg�t	j�|j|�|jg�ddd�y#1swYyxYwr")
rEr0rK�assertFalser&�
is_trackedr8r(rerp�r3r}rds   r�test_non_gcz"SimpleFinalizationTest.test_non_gc�s���
�_�_�
���A����R�]�]�1�-�.��a�5�'�C���J�J�L��!�!�#�&��!�!�"�%��J�J�L��!�!�#�&��!�!�"�%��
�
�s�B(C�Cc���tj�5t�}|jt	j
|��t
|�g}~t	j�|j|�|j|�|j�t	j�|j|dz�|j|�ddd�y#1swYyxYw�N�)rEr0rMr�r&r�r8r(rerprur�s   r�test_non_gc_resurrectz,SimpleFinalizationTest.test_non_gc_resurrect�s���
�_�_�
� �"�A����R�]�]�1�-�.��a�5�'�C���J�J�L��!�!�#�&��!�!�#�&�� � �"��J�J�L��!�!�#��'�*��!�!�#�&��
�
�s�B;C�C"N)	rrrrr�r�cpython_onlyr�r�rrrrwrw�sE���&�"� 
���&��&�
���'��'rrwc�(��eZdZ�fd�Z�fd�Z�xZS)�
SelfCycleBasec�0��t�|��||_yr")�superrHrz�r3�	__class__s �rrHzSelfCycleBase.__init__�s���
������rc�"��t�|��yr")r�r4r�s �rr4zSelfCycleBase.check_sanity�s���
���r)rrrrHr4�
__classcell__�r�s@rr�r��s���� � rr�c��eZdZy)�SimpleSelfCycleNrSrrrr�r��rTrr�c��eZdZy)�SelfCycleResurrectorNrSrrrr�r��rTrr�c��eZdZd�Zy)�SuicidalSelfCyclec��	d|_yr")rzr2s rr9zSuicidalSelfCycle.side_effect�s��	���rNrXrrrr�r��s��rr�c� �eZdZ	d�Zd�Zd�Zy)�SelfCycleFinalizationTestc��tj�5t�}t|�g}t	j
|�}~t
j�|j|�|jg�|j|�d�t
j�|j|�|jg�ddd�y#1swYyxYwr")rEr0r�r8ryrzr&r(rerpr{r|s    rrz%SelfCycleFinalizationTest.test_simples���
�_�_�
��!�A��a�5�'�C����Q��B���J�J�L��!�!�#�&��!�!�"�%��M�M�"�$��%��J�J�L��!�!�#�&��!�!�"�%��
�
�r�c��tj�5t�}t|�g}t	j
|�}~t
j�|j|�|j|�|j|�d�|j�t
j�|j|�|jg�|j|�d�ddd�y#1swYyxYwr")rEr0r�r8ryrzr&r(rerpr{rur|s    rr�z/SelfCycleFinalizationTest.test_simple_resurrects���
�_�_�
�$�&�A��a�5�'�C����Q��B���J�J�L��!�!�#�&��!�!�#�&��M�M�"�$��%�
� � �"��J�J�L��!�!�#�&��!�!�"�%��M�M�"�$��%�!�
�
�s�CC5�5C>c���tj�5t�}t|�g}t	j
|�}~t
j�|j|�|jg�|j|�d�t
j�|j|�|jg�|j|�d�ddd�y#1swYyxYwr")rEr0r�r8ryrzr&r(rerpr{r|s    r�test_simple_suicidez-SelfCycleFinalizationTest.test_simple_suicide%s����_�_�
�!�#�A��a�5�'�C����Q��B���J�J�L��!�!�#�&��!�!�"�%��M�M�"�$��%��J�J�L��!�!�#�&��!�!�"�%��M�M�"�$��%��
�
�s�CC%�%C.N)rrrrr�r�rrrr�r��s���
&�&�(&rr�c�$��eZdZd�Z�fd�Z�xZS)�ChainedBasec�.�d|_||_||_y)NF��suicided�left�right)r3r�s  r�chainzChainedBase.chain9s����
���	���
rc���t�|��|jry|j}|jr	|j}|jryyr")r�r4r�r�r�)r3r�r�r�s   �rr4zChainedBase.check_sanity>s9���
�����=�=��9�9�D��}�}��J�J�E��~�~r)rrrr�r4r�r�s@rr�r�7s����
*�*rr�c��eZdZy)�
SimpleChainedNrSrrrr�r�OrTrr�c��eZdZy)�ChainedResurrectorNrSrrrr�r�RrTrr�c��eZdZd�Zy)�SuicidalChainedc�0�	d|_d|_d|_y)NTr�r2s rr9zSuicidalChained.side_effectWs��	���
���	���
rNrXrrrr�r�Us��rr�c�P�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�CycleChainFinalizationTestc��|D�cgc]	}|���}}tt|��D]}||j||dz
��|Scc}w)N�)�range�lenr�)r3�classesr�nodes�is     r�build_chainz&CycleChainFinalizationTest.build_chaingsM��")�*�'�3���'��*��s�5�z�"�A��!�H�N�N�5��1��:�&�#����+s�A
c�*�t|�}tj�5|j|�}|D�cgc]
}t	|���}}|D�cgc]}tj|���}}~tj�|j|�|jg�|j|D�cgc]	}|���c}dg|z�tj�|j|�ddd�ycc}wcc}wcc}w#1swYyxYwr")r�rEr0r�r8ryrzr&r(rerpr_)r3r��Nr�r}rd�wrsr~s        r�check_non_resurrecting_chainz7CycleChainFinalizationTest.check_non_resurrecting_chainms�����L��
�_�_�
��$�$�W�-�E�"'�(�%�Q�2�a�5�%�C�(�+0�1�5�a�7�;�;�q�>�5�C�1���J�J�L��!�!�#�&��!�!�"�%����S�1�S�r�b�d�S�1�D�6�A�:�>��J�J�L��!�!�#�&��
��(��1��
2��
�s5�D	�C:�D	�C?�*AD	�2D
�1D	�:D	�	Dc���t|�}tj�5|j|�}t|�}|D�cgc]
}t	|���}}|D�cgc]}t|t�s�t	|��� }}|D�cgc]}tj|���}}~tj�|j|�|j|�|j|D�cgc]	}|���c}dg|z�|j�tj�|j|�|jg�ddd�ycc}wcc}wcc}wcc}w#1swYyxYwr")r�rEr0r�r8�
isinstancerVryrzr&r(rerpr_ru)	r3r�r�r�r}rd�survivor_idsr�r~s	         r�check_resurrecting_chainz3CycleChainFinalizationTest.check_resurrecting_chain{s%����L��
�_�_�
��$�$�W�-�E��E�
�A�"'�(�%�Q�2�a�5�%�C�(�+0�U�5�a�J�q�BS�4T�B�q�E�5�L�U�+0�1�5�a�7�;�;�q�>�5�C�1���J�J�L��!�!�#�&��!�!�,�/����S�1�S�r�b�d�S�1�D�6�A�:�>�� � �"��J�J�L��!�!�#�&��!�!�"�%��
��)��U��1��2��
�sI�!E#�E�E#�E�/
E�<E#�E�AE#�&E
�4AE#�E#�#E,c�6�|jtgdz�y�N�)r�r�r2s r�test_homogenousz*CycleChainFinalizationTest.test_homogenous�s���)�)�=�/�A�*=�>rc�6�|jtgdz�yr�)r�r�r2s r�test_homogenous_resurrectz4CycleChainFinalizationTest.test_homogenous_resurrect�s���%�%�'9�&:�Q�&>�?rc�6�|jtgdz�yr�)r�r�r2s r�test_homogenous_suicidalz3CycleChainFinalizationTest.test_homogenous_suicidal�s���)�)�?�*;�a�*?�@rc�@�|jttgdz�yr��r�r�r�r2s r�test_heterogenous_suicidal_onez9CycleChainFinalizationTest.test_heterogenous_suicidal_one�s���)�)�?�M�*J�Q�*N�Orc�L�|jtgdztgdzz�yr�r�r2s r�test_heterogenous_suicidal_twoz9CycleChainFinalizationTest.test_heterogenous_suicidal_two�s'���)�)�
���!�]�O�a�$7�7�	9rc�@�|jttgdz�yr�)r�r�r�r2s r�test_heterogenous_resurrect_onez:CycleChainFinalizationTest.test_heterogenous_resurrect_one�s���%�%�'9�=�&I�A�&M�Nrc�J�|jtttgdz�yr��r�r�r�r�r2s r�test_heterogenous_resurrect_twoz:CycleChainFinalizationTest.test_heterogenous_resurrect_two�s ���%�%�
���@�1�D�	Frc�b�|jtgdztgdzztgdzz�yr�r�r2s r�!test_heterogenous_resurrect_threez<CycleChainFinalizationTest.test_heterogenous_resurrect_three�s6���%�%�
� �1�$�
���':�:�o�=N�QR�=R�R�	TrN)rrrr�r�r�r�r�r�r�r�r�r�r�rrrr�r�`sD����'�&�&?�@�A�P�9�O�F�Trr�c��eZdZd�Zd�Zy)�
LegacyBasec���	|js5|jjt|��|j	�yy#t
$r%}|jj|�Yd}~yd}~wwxYwr")r/r)r7r8r4r:r%r;s  rr=zLegacyBase.__del__�s^��	"��>�>����%�%�b��h�/��!�!�#�"���	"��K�K���q�!�!��	"�s�AA�	A2�
A-�-A2c��		|jsE|jjt|��|j	�|j�yy#t$r%}|jj|�Yd}~yd}~wwxYwr")r/r*r7r8r4r9r:r%r;s  r�
__tp_del__zLegacyBase.__tp_del__�so��	�	"��>�>��!�!�(�(��D��2��!�!�#�� � �"�"���	"��K�K���q�!�!��	"�r>N)rrrr=r�rrrr�r��s��"�
"rr�c��eZdZy)�LegacyNrSrrrr�r�����rr�c��eZdZd�Zy)�LegacyResurrectorc�<�	|jj|�yr"rOr2s rr9zLegacyResurrector.side_effect�rPrNrXrrrr�r��s��$rr�c��eZdZy)�LegacySelfCycleNrSrrrr�r��r�rr�c�2��eZdZ	�fd�Zd�Zd�Zd�Z�xZS)�LegacyFinalizationTestc���tjj�tj�t�|��yr")r&r'r$r(r�r`r�s �rr`zLegacyFinalizationTest.tearDown�s)���	�
�
����
�
�
��
���rc���tj�5t�}t|�g}t	j
|�}~t
j�|j|�|j|�|jg�|j|�d�t
j�|j|�|j|�ddd�y#1swYyxYwr")rEr0r�r8ryrzr&r(rergrpr{r|s    r�test_legacyz"LegacyFinalizationTest.test_legacy�s���
�_�_�
���A��a�5�'�C����Q��B���J�J�L��!�!�#�&��$�$�S�)��!�!�"�%��M�M�"�$��%��J�J�L��!�!�#�&��$�$�S�)��
�
�s�CC�C(c�L�tj�5t�}t|�g}t	j
|�}~t
j�|j|�|j|�|j|�|j|�d�|j�t
j�|j|�|j|dz�|j|�ddd�|j�d�y#1swY�!xYwr�)
rEr0r�r8ryrzr&r(rergrpr{rur|s    r�test_legacy_resurrectz,LegacyFinalizationTest.test_legacy_resurrect�s���
�_�_�
�!�#�A��a�5�'�C����Q��B���J�J�L��!�!�#�&��$�$�S�)��!�!�#�&��M�M�"�$��%�� � �"��J�J�L��!�!�#�&��$�$�S�1�W�-��!�!�#�&�� 	
�
�
�b�d�D�!�!�
�s�C%D�D#c��tj�5t�}t|�g}t	j
|�}~t
j�|jg�|jg�|jg�|j|�|j|�d�dtjd_ddd�|jg�|j�d�y#1swY�2xYw)Nr)rEr0r�r8ryrzr&r(rergrprsr�r'r{r|s    r�test_legacy_self_cyclez-LegacyFinalizationTest.test_legacy_self_cycles���
�_�_�
��!�A��a�5�'�C����Q��B���J�J�L��!�!�"�%��$�$�R�(��!�!�"�%�����$����R�T�4�(� $�B�J�J�q�M���	
���B���
�
�b�d�D�!��
�s�B4C:�:D)rrrr`r�r�r�r�r�s@rr�r��s�����
*�"�&"rr��__main__)%rBr&�unittestry�	_testcapir�ImportErrorrr0rr rErKrMrRrVrZ�TestCaserwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�mainrrr�<module>r�s����	����%��$��?�?�D$��$���O�����$��$��$�	�Z�	�$�
�$�%�%�<>'�X�x�'8�'8�>'�B � �	�m�V�	�	�=�*;�	��
�v��7&��(�*;�*;�7&�t*�*�0	�K��	�	��&7�	��k�6��GT��8�+<�+<�GT�Z"��"�0
�	�Z�	�
�	�
�$�
�$�
�$�
�	�m�Z�	�
�	�	���>"�X�x�'8�'8�>"��>"�B�z���H�M�M�O���[���������s"�F�F!�F�F�!F-�,F-

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists