Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_sys_setprofile.cpython-312.pyc

�

'Μg#:��P�ddlZddlZddlZddlZGd�dej�ZGd�d�ZGd�de�ZGd�d	ej�ZGd
�de�Z	Gd�d
e�Z
d�Zd�Zee�Z
dd�Zd�ZGd�dej�Zedk(rej$�yy)�Nc�$�eZdZd�Zd�Zd�Zd�Zy)�TestGetProfilec�.�tjd�y�N��sys�
setprofile��selfs �5/usr/local/lib/python3.12/test/test_sys_setprofile.py�setUpzTestGetProfile.setUp������t��c�.�tjd�yrrr
s r�tearDownzTestGetProfile.tearDownrrc�J�|jtj��yr)�assertIsNoner�
getprofiler
s r�
test_emptyzTestGetProfile.test_emptys�����#�.�.�*�+rc�|�d�}tj|�|jtj�|�y)Nc��yr���argss r�fnz&TestGetProfile.test_setget.<locals>.fn���r)rr	�assertIsr)rrs  r�test_setgetzTestGetProfile.test_setgets*��	�	���r���
�
�c�n�n�&��+rN)�__name__�
__module__�__qualname__r
rrrrrrrrs����,�,rrc�&�eZdZd�Zd�Zdd�Zd�Zy)�HookWatcherc� �g|_g|_yr)�frames�eventsr
s r�__init__zHookWatcher.__init__s�������rc�H�|dk(s
|dk(s|dk(r|j||�yy)N�call�return�	exception��	add_event�r�frame�event�args    r�callbackzHookWatcher.callbacks,���V�O��� ���#��N�N�5�%�(�$rNc�6�|�tjd�}	|jj|�}|jj
||t|�f�y#t$r3t|j�}|jj
|�Y�cwxYw)zAdd an event to the log.N�)	r�	_getframer%�index�
ValueError�len�appendr&�ident)rr0r/�framenos    rr-zHookWatcher.add_event#s~���=��M�M�!�$�E�	&��k�k�'�'��.�G�
	
�����G�U�E�%�L�9�:��	�	&��$�+�+�&�G��K�K���u�%�	&�s�A�9B�Bc��t|jj�tt�g}d|_|jD�cgc]}|d|vs�|��c}Scc}w)zRemove calls to add_event().N�)r:r-�__func__r%r&)r�
disallowed�items   r�
get_eventszHookWatcher.get_events0sM���D�N�N�3�3�4�e�E�l�C�
����!%���J����Q��z�0I���J�J��Js�A�Ar)rr r!r'r2r-rArrrr#r#s���)�;�Krr#c�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zeeeeeed�Z	y)	�ProfileSimulatorc�J�||_g|_tj|�yr)�testcase�stackr#r')rrEs  rr'zProfileSimulator.__init__9s�� ��
���
����T�"rc�0�|j|||�yr)�dispatchr.s    rr2zProfileSimulator.callback>s����
�
�e��T�5�)rc�^�|jd|�|jj|�y)Nr))r-rFr9�rr/s  r�
trace_callzProfileSimulator.trace_callBs"�����v�u�%��
�
���%� rc�\�|jd|�|jj�y)Nr*)r-rF�poprJs  r�trace_returnzProfileSimulator.trace_returnFs�����x��'��
�
���rc�:�|jjd�y)Nz2the profiler should never receive exception events)rE�failrJs  r�trace_exceptionz ProfileSimulator.trace_exceptionJs���
�
���@�	Brc��yrrrJs  r�
trace_passzProfileSimulator.trace_passNs��r)r)r+r*�c_call�c_return�c_exceptionN)
rr r!r'r2rKrNrQrSrHrrrrCrC8s<��#�
*�!��B�
��$����!�

�HrrCc��eZdZd�Zy)�TestCaseBasec��t||j��}||k7r>|jdtj|��dtj|����yy)NzExpected events:
z
Received events:
)�capture_events�new_watcherrP�pprint�pformat)r�callable�expectedr&s    r�check_eventszTestCaseBase.check_events\sN����$�*:�*:�*<�=���X���I�I�����1�6�>�>�&�3I�K�
L�rN)rr r!r`rrrrXrX[s��LrrXc�f�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�ProfileHookTestCasec��t�Sr)r#r
s rr[zProfileHookTestCase.new_watcherds
���}�rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��yrr��ps r�fz*ProfileHookTestCase.test_simple.<locals>.fhrrr4r)r*�r:r`�rrh�f_idents   r�test_simplezProfileHookTestCase.test_simpleg�8��	���(�����!�q�&�'�2� �(�G�4� �	!rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzy�Nr4rrrfs rrhz-ProfileHookTestCase.test_exception.<locals>.fp�	��
�a�Crr4r)r*rirjs   r�test_exceptionz"ProfileHookTestCase.test_exceptiono�8��	���(�����!�q�&�'�2� �(�G�4� �	!rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzy#YyxYwrprrfs rrhz4ProfileHookTestCase.test_caught_exception.<locals>.fx����1����D����r4r)r*rirjs   r�test_caught_exceptionz)ProfileHookTestCase.test_caught_exceptionw�:��	���(�����!�q�&�'�2� �(�G�4� �	!rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzy#YyxYwrprrfs rrhz;ProfileHookTestCase.test_caught_nested_exception.<locals>.f�rvrwr4r)r*rirjs   r�test_caught_nested_exceptionz0ProfileHookTestCase.test_caught_nested_exception�ryrc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzyrprrfs rrhz4ProfileHookTestCase.test_nested_exception.<locals>.f�rqrr4r)r*rirjs   r�test_nested_exceptionz)ProfileHookTestCase.test_nested_exception�s:��	���(�����!�q�&�'�2� !�(�G�4�	 �	!rc���d���fd�}t��}t|�}|j|dd|fdd|fdd|fdd|fdd|fdd|fg�y)Nc��ddzyrprrfs rrhz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.f�rqrc�F��	�|�y#�|�Yy#YYyxYwxYwrr�rgrhs �r�gz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.g�s#���
��!���
��q�T����s�� ��� � r4r)r=r*�ri�rr�rk�g_identrhs    @r�test_exception_in_except_clausez3ProfileHookTestCase.test_exception_in_except_clause�sq���	�	���(����(�����!�q�&�'�2� �&�'�2� �(�G�4� �&�'�2� �(�G�4� �(�G�4� �	!rc
���d���fd�}t��}t|�}|j|dd|fdd|fdd|fdd|fdd|fg�y)Nc��ddzyrprrfs rrhz9ProfileHookTestCase.test_exception_propagation.<locals>.f�rqrc�d���|�|jd�y#|jd�wxYw)N�falling throughr,r�s �rr�z9ProfileHookTestCase.test_exception_propagation.<locals>.g�s%����1���[�[�!2�3��Q�[�[�!2�3�s��/r4r)r=r*r�rir�s    @r�test_exception_propagationz.ProfileHookTestCase.test_exception_propagation�sh���	�	4���(����(�����!�q�&�'�2� �&�'�2� �(�G�4� �"3�W�=� �(�G�4�	 �	!rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc�&�ddzy#ddzYyxYwrprrfs rrhz/ProfileHookTestCase.test_raise_twice.<locals>.f�s���1����A�a�C�s��r4r)r*rirjs   r�test_raise_twicez$ProfileHookTestCase.test_raise_twice�s:��	���(�����!�q�&�'�2� �(�G�4� �	!rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzy#�xYwrprrfs rrhz1ProfileHookTestCase.test_raise_reraise.<locals>.f�s���1����E�s��
r4r)r*rirjs   r�test_raise_reraisez&ProfileHookTestCase.test_raise_reraise�s:��	���(�����!�q�&�'�2� �(�G�4� �	!rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��t��r)�	Exceptionrfs rrhz)ProfileHookTestCase.test_raise.<locals>.f�s
���+�rr4r)r*rirjs   r�
test_raisezProfileHookTestCase.test_raise�s8��	���(�����!�q�&�'�2� �(�G�4� �	!rc����	�
�d���fd���fd��	�	fd��
�
fd�}t��}t��}t�	�}t�
�}t|�}|j|dd|fdd|fd	d|fd
d|fdd|fdd|fd
d|fd	d|fdd|fdd|fg
�y)
Nc��ddzyrprrrrrhz5ProfileHookTestCase.test_distant_exception.<locals>.f�rqrc�����yrr�rhs�rr�z5ProfileHookTestCase.test_distant_exception.<locals>.g�����
�Crc�����yrr�r�s�r�hz5ProfileHookTestCase.test_distant_exception.<locals>.h�r�rc�����yrr�r�s�r�iz5ProfileHookTestCase.test_distant_exception.<locals>.i�r�rc�����yrr�rgr�s �r�jz5ProfileHookTestCase.test_distant_exception.<locals>.j�r�rr4r)r=r���r*ri�rr�rkr��h_ident�i_ident�j_identrhr�r�r�s       @@@@r�test_distant_exceptionz*ProfileHookTestCase.test_distant_exception�����	�	�	�	�	���(����(����(����(����(�����!�q�&�'�2� �&�'�2� �&�'�2� �&�'�2� �&�'�2� �(�G�4� �(�G�4� �(�G�4� �(�G�4� �(�G�4�
 �
	!rc
���d���fd�}t��}t|�}|j|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�y)Nc3�4K�td�D]}|���y�w�Nr=��range�r�s rrhz-ProfileHookTestCase.test_generator.<locals>.f�������1�X�������c�����D]}�yrr�rgr�rhs  �rr�z-ProfileHookTestCase.test_generator.<locals>.g������S���rr4r)r=r*rir�s    @r�test_generatorz"ProfileHookTestCase.test_generator�s����	�	���(����(�����!�q�&�'�2� �&�'�2� �(�G�4� �&�'�2� �(�G�4� !�&�'�2� �(�G�4� �(�G�4� �	!rc���d���fd�}t��}t|�}|j|dd|fdd|fdd|fdd|fdd|fdd|fg�y)Nc3�4K�td�D]}|���y�wr�r�r�s rrhz8ProfileHookTestCase.test_unfinished_generator.<locals>.fr�r�c�&��t���yr)�nextr�s �rr�z8ProfileHookTestCase.test_unfinished_generator.<locals>.gs������Irr4r)r=r*rir�s    @r�test_unfinished_generatorz-ProfileHookTestCase.test_unfinished_generatorss���	�	���(����(�����!�q�&�'�2� �&�'�2� �(�G�4� !�&�'�2� �(�G�4� �(�G�4� �	!rc
���d���fd�}t��}t|�}|j|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�y)Nc3�4K�td�D]}|���y�wr�r�r�s rrhz2ProfileHookTestCase.test_stop_iteration.<locals>.fr�r�c�����D]}�yrrr�s  �rr�z2ProfileHookTestCase.test_stop_iteration.<locals>.gr�rr4r)r=r*rir�s    @r�test_stop_iterationz'ProfileHookTestCase.test_stop_iterations����	�	���(����(�����!�q�&�'�2� �&�'�2� �(�G�4� �&�'�2� �(�G�4� �&�'�2� �(�G�4� �(�G�4�
 �
	!rN)rr r!r[rlrrrxr|rr�r�r�r�r�r�r�r�r�rrrrbrbcsM���!�!�!�!�	!�!�&
!�!�!�!�!�8!�,!�&!rrbc�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�ProfileSimulatorTestCasec��t|�Sr)rCr
s rr[z$ProfileSimulatorTestCase.new_watcher,s
����%�%rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��yrrrfs rrhz/ProfileSimulatorTestCase.test_simple.<locals>.f0rrr4r)r*rirjs   rrlz$ProfileSimulatorTestCase.test_simple/rmrc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzyrprrfs rrhz8ProfileSimulatorTestCase.test_basic_exception.<locals>.f8rqrr4r)r*rirjs   r�test_basic_exceptionz-ProfileSimulatorTestCase.test_basic_exception7rsrc�T�d�}t|�}|j|dd|fdd|fg�y)Nc��ddzy#YyxYwrprrfs rrhz9ProfileSimulatorTestCase.test_caught_exception.<locals>.f@rvrwr4r)r*rirjs   rrxz.ProfileSimulatorTestCase.test_caught_exception?ryrc����	�
�d���fd���fd��	�	fd��
�
fd�}t��}t��}t�	�}t�
�}t|�}|j|dd|fdd|fd	d|fd
d|fdd|fdd|fd
d|fd	d|fdd|fdd|fg
�y)
Nc��ddzyrprrrrrhz:ProfileSimulatorTestCase.test_distant_exception.<locals>.fIrqrc�����yrrr�s�rr�z:ProfileSimulatorTestCase.test_distant_exception.<locals>.gKr�rc�����yrrr�s�rr�z:ProfileSimulatorTestCase.test_distant_exception.<locals>.hMr�rc�����yrrr�s�rr�z:ProfileSimulatorTestCase.test_distant_exception.<locals>.iOr�rc�����yrrr�s �rr�z:ProfileSimulatorTestCase.test_distant_exception.<locals>.jQr�rr4r)r=r�r�r�r*rir�s       @@@@rr�z/ProfileSimulatorTestCase.test_distant_exceptionHr�rc�^��i��fd�}t|�}|j|dd|fdd|fg�y)Nc�4��tjidfi���y�N�*��dict�get�rg�kwargss �rrhz7ProfileSimulatorTestCase.test_unbound_method.<locals>.fgs����H�H�R��&�v�&rr4r)r*ri�rrhrkr�s   @r�test_unbound_methodz,ProfileSimulatorTestCase.test_unbound_methodes>�����	'���(�����!�q�&�'�2� �(�G�4�6�	7rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc�,�tj�yrr�rfs rrhz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.fos���H�H�Jrr4r)r*rirjs   r�test_unbound_method_no_argsz4ProfileSimulatorTestCase.test_unbound_method_no_argsns8��	���(�����!�q�&�'�2� �(�G�4�6�	7rc�T�d�}t|�}|j|dd|fdd|fg�y)Nc�8�tjtd�yr��r�r��printrfs rrhzDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fws���H�H�U�B�rr4r)r*rirjs   r� test_unbound_method_invalid_argsz9ProfileSimulatorTestCase.test_unbound_method_invalid_argsvs8��	 ���(�����!�q�&�'�2� �(�G�4�6�	7rc�^��i��fd�}t|�}|j|dd|fdd|fg�y)Nc�0��tjdi���y)Nrr�r�s �rrhzGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.f�s����H�H��v�rr4r)r*rir�s   @r�#test_unbound_method_no_keyword_argsz<ProfileSimulatorTestCase.test_unbound_method_no_keyword_args~s>�����	���(�����!�q�&�'�2� �(�G�4�6�	7rc�^��i��fd�}t|�}|j|dd|fdd|fg�y)Nc�<��tjtdfi���yr�r�r�s �rrhzLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.f�s����H�H�U�B�)�&�)rr4r)r*rir�s   @r�(test_unbound_method_invalid_keyword_argszAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args�s>�����	*���(�����!�q�&�'�2� �(�G�4�6�	7rN)
rr r!r[rlr�rxr�r�r�r�r�r�rrrr�r�+s4��&�!�!�!�!�:7�7�7�7�7rr�c�|�t|d�r
|j}n|j}|j|jfS)N�f_code)�hasattrr��__code__�co_firstlineno�co_name)�function�codes  rr:r:�s5���x��"������ � ��������,�,rc�"�||�y#YyxYwrr)rhrgs  r�protectr��s��	
�1����D�s�
�c�x�|�
t�}tj�}tj�	t	j
|j�t||�t	j
d�|rtj�	|j�ddS#|rtj�wwxYw)Nr4���)
r#�gc�	isenabled�disablerr	r2r��enablerA)r^rg�old_gcs   rrZrZ�s����y��M���\�\�^�F��J�J�L�����q�z�z�"���!�����t����I�I�K��<�<�>�!�B������I�I�K��s�AB � B9c�B�ddl}|jt|��y)Nr)r\rZ)r^r\s  r�show_eventsr��s����F�M�M�.��*�+rc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
TestEdgeCasesc��|jtjtj��tjd�yr)�
addCleanuprr	rr
s rr
zTestEdgeCases.setUp�s'�����������(8�9����t�rc����d�}d��G�fd�d�}tj|��tj|�|jtj���y)Nc��yrrrs r�fooz*TestEdgeCases.test_reentrancy.<locals>.foo����rc��yrrrs r�barz*TestEdgeCases.test_reentrancy.<locals>.bar�rrc���eZdZd�Z�fd�Zy)�(TestEdgeCases.test_reentrancy.<locals>.Ac��yrr)rrs  r�__call__z1TestEdgeCases.test_reentrancy.<locals>.A.__call__�s��rc�0��tj��yrr)rrs �r�__del__z0TestEdgeCases.test_reentrancy.<locals>.A.__del__�s������s�#rN)rr r!rr)rs�r�Ar
�s
���
�
$rr)rr	�assertEqualr)rrrrs   @r�test_reentrancyzTestEdgeCases.test_reentrancy�sJ���	�	�	$�	$�	���q�s�����s��������)�3�/rc��d�}tj|�~tjtj��y)Nc��yrrrs rrz+TestEdgeCases.test_same_object.<locals>.foo�rr)rr	r)rrs  r�test_same_objectzTestEdgeCases.test_same_object�s+��	�	���s������s�~�~�'�(rc��d�}dtj�_tj�}tjd��|�tj|�tj
d��|�y)Nc��yrrrrrrhz9TestEdgeCases.test_profile_after_trace_opcodes.<locals>.f�rrTc��yrrrs r�<lambda>z@TestEdgeCases.test_profile_after_trace_opcodes.<locals>.<lambda>�s��4rc��yrrrs rrz@TestEdgeCases.test_profile_after_trace_opcodes.<locals>.<lambda>�s��Tr)rr5�f_trace_opcodes�gettrace�settracer	)rrh�
prev_traces   r� test_profile_after_trace_opcodesz.TestEdgeCases.test_profile_after_trace_opcodes�sR��	�+/��
�
��'��\�\�^�
����'�(�	�����Z� ����)�*�	�rc����Gd�d�}g�tj�fd��|�j�tjd�|j�gd��y)Nc��eZdZee�Zy)�4TestEdgeCases.test_method_with_c_function.<locals>.AN)rr r!�classmethod�reprrhrrrrr!�s���D�!�Arrc�&���j|�Sr)r9)r/r0rr&s   �rrz;TestEdgeCases.test_method_with_c_function.<locals>.<lambda>�s���&�-�-��2Fr)rTrUrT)rr	rhr)rrr&s  @r�test_method_with_c_functionz)TestEdgeCases.test_method_with_c_function�sG���
	"�	"������F�G�	��������t������!A�BrN)rr r!r
rrrr%rrrrr�s���0�$)�
�Crr�__main__r)r�r\r�unittest�TestCaserr#rCrXrbr�r:r��
protect_identrZr�rr�mainrrr�<module>r+s���	�
�
��,�X�&�&�,�"K�K�@ 
�{� 
�FL�8�$�$�L�E!�,�E!�Pb7�|�b7�J-���g��
� �",�
8C�H�%�%�8C�v�z���H�M�M�O�r

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