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_monitoring.cpython-312.pyc

�

'Μg��	�h�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	dZ
d�Zd�Zd�Z
d�Zd�Zd	Zd
ZdZGd�d
ej&�ZGd�d�ZGd�deej&�Zej.j0Zej4dfej6dfej8dfej:dfej<dfej>dfgZ ejBdfejDdfejFdfgZ$e e$zejJdfejLdfgzZ'ejPejRe'D��cgc]\}}|��	c}}d�ejTzZ+d�Z,gd�e,_d�Z-gd �e-_d!�Z.gd"�e._d#�Z/gd$�e/_d%�Z0gd&�e0_ejbejdfZ3Gd'�d(e�Z4Gd)�d*e4ej&�Z5ejLejJej8ejDej:fZ6ej4ej6fZ7dd+l8m9Z9Gd,�d-e4ej&�Z:Gd.�d/�Z;Gd0�d1�Z<Gd2�d3eej&�Z=Gd4�d5eej&�Z>Gd6�d7eej&�Z?Gd8�d9eej&�Z@Gd:�d;�ZAGd<�d=eej&�ZBGd>�d?eA�ZCGd@�dAeA�ZDGdB�dCeA�ZEGdD�dEeA�ZFGdF�dGeA�ZGGdH�dIeB�ZHGdJ�dK�ZIGdL�dM�ZJGdN�dO�ZKGdP�dQeK�ZLGdR�dSeK�ZMeAeJeIeLeMfZNGdT�dUeB�ZOGdV�dW�ZPePeIfZQGdX�dYeB�ZRGdZ�d[eej&�ZSeJeIeLeMfZTGd\�d]eej&�ZUd^�ZVGd_�d`�ZWGda�dbeW�ZXGdc�dd�ZYeWeXfZZeWeXeIfZ[eWeXeIeAeYfZ\Gde�dfeB�Z]Gdg�dheB�Z^Gdi�djeej&�Z_Gdk�dlej&e�Z`Gdm�dneej&�Zaycc}}w)oz"Test suite for the sys.monitoring.�N�r�c��y�N�r��1/usr/local/lib/python3.12/test/test_monitoring.py�f1r
���rc�D�tg�tjd�y�Nr)�len�sys�	getsizeofrrr	�f2rs����G��M�M�!�rc��tD]}�yr)�PAIR)�items r	�flooprs�����rc#�K�d��d��y�wrrrrr	�genrs����	�	���
c�"�t�D]}�yr)r)�_s r	�g1rs��
�U���r���c��eZdZd�Zd�Zy)�MonitoringBasicTestc�p�tj}|j|j|j|j
|j|j|j|j|j|j|j|j|jjyr)r�
monitoring�events�use_tool_id�free_tool_id�get_tool�
get_events�
set_events�get_local_events�set_local_events�register_callback�restart_events�DISABLE�MISSING�	NO_EVENTS)�self�ms  r	�test_has_objectsz$MonitoringBasicTest.test_has_objects(st���N�N��	���	�
�
�	���	�
�
�	���	���	���	���	���	���	�	�	�	�	�	�	����rc��tjjtd�|j	tjjt�d�tjj
td�|j	tjjt�d�tjj
td�|jt�5tjj
ttjjj�ddd�|jt�5tjj
ttjjj�ddd�tjjt�|j	tjjt�d�|jt�5tjj
ttjjj�ddd�y#1swY��)xYw#1swY��xYw#1swYyxYw)NzMonitoringTest.Tool�r)rr"r$�	TEST_TOOL�assertEqualr&r(r'�assertRaises�
ValueErrorr#�C_RETURN�C_RAISEr%�CALL�r0s r	�	test_toolzMonitoringBasicTest.test_tool8sp�����"�"�9�.C�D�������0�0��;�=R�S����!�!�)�R�0�������2�2�9�=�r�B����!�!�)�Q�/�
�
�
�z�
*��N�N�%�%�i����1F�1F�1O�1O�P�+�
�
�
�z�
*��N�N�%�%�i����1F�1F�1N�1N�O�+����#�#�I�.�������0�0��;�T�B�
�
�
�z�
*��N�N�%�%�i����1F�1F�1K�1K�L�+�
*�
+�
*��
*�
*��+�
*�s'�(AI�AI#�AI/�I �#I,�/I8N)�__name__�
__module__�__qualname__r2r=rrr	r r &s
��� 
Mrr c��eZdZd�Zd�Zy)�MonitoringTestBasec��td�D]1}|jtjj	|�d��3|jtjj
t�d�|jtjj
t�d�|jtjj
t�d�tjjtd|jjz�tjjtd|jjz�tjjtd|jjz�y)N�rztest ztest2 ztest3 )
�ranger6rr"r'�assertIsr&r5�
TEST_TOOL2�
TEST_TOOL3r$�	__class__r>�r0�tools  r	�setUpzMonitoringTestBase.setUpJs����!�H�D����S�^�^�6�6�t�<�a�@���
�
�c�n�n�-�-�i�8�$�?��
�
�c�n�n�-�-�j�9�4�@��
�
�c�n�n�-�-�j�9�4�@����"�"�9�g����8O�8O�.O�P����"�"�:�x�$�.�.�:Q�:Q�/Q�R����"�"�:�x�$�.�.�:Q�:Q�/Q�Rrc�T�td�D]1}|jtjj	|�d��3tjjt�tjjt�tjjt�y)NrDr)	rEr6rr"r'r%r5rGrHrJs  r	�tearDownzMonitoringTestBase.tearDownUse���!�H�D����S�^�^�6�6�t�<�a�@�����#�#�I�.����#�#�J�/����#�#�J�/rN)r>r?r@rLrNrrr	rBrBHs
��	S�0rrBc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�MonitoringCountTestc��Gd�d�}|�}tjjt||�|tj
k(s|tjk(r3tjjttj�n$tjjt|�|j|jd�d|_
|�|j|j|�tjjt|d�}d|_
|�|j|jd�|j||�tjjtd�y)Nc��eZdZd�Zd�Zy)�6MonitoringCountTest.check_event_count.<locals>.Counterc��d|_yr
��countr<s r	�__init__z?MonitoringCountTest.check_event_count.<locals>.Counter.__init__cs	����
rc�.�|xjdz
c_y�NrrU�r0�argss  r	�__call__z?MonitoringCountTest.check_event_count.<locals>.Counter.__call__es���
�
�a��
rN�r>r?r@rWr\rrr	�CounterrSbs��
�
 rr^r)rr"r+r5�Er9r:r(r;r6rV)r0�func�event�expectedr^�counter�prevs       r	�check_event_countz%MonitoringCountTest.check_event_count`s���	 �	 ��)�����(�(��E�7�C��A�J�J��%�1�9�9�"4��N�N�%�%�i����8��N�N�%�%�i��7��������*���
����������1��~�~�/�/�	�5�$�G����
����������*�����w�'����!�!�)�Q�/rc�N�|jttjd�yrY)rer
r_�PY_STARTr<s r	�test_start_countz$MonitoringCountTest.test_start_county������r�1�:�:�q�1rc�N�|jttjd�y�Nr)rerr_�	PY_RESUMEr<s r	�test_resume_countz%MonitoringCountTest.test_resume_count|������r�1�;�;��2rc�N�|jttjd�yrY)rer
r_�	PY_RETURNr<s r	�test_return_countz%MonitoringCountTest.test_return_countrnrc�N�|jttjd�y)Nr)rerr_r;r<s r	�test_call_countz#MonitoringCountTest.test_call_count�s�����r�1�6�6�1�-rc�N�|jttjd�yrk)rerr_r9r<s r	�test_c_return_countz'MonitoringCountTest.test_c_return_count�rirN)	r>r?r@rerhrmrqrsrurrr	rPrP^s ��0�22�3�3�.�2rrP�start�resume�return�yield�jump�branch�raise�unwind�exception_handled�c_raise�c_returnc��yrrrrr	�	just_passr��rr)�py_callrvrxc��t�r��	Exceptionrrr	�
just_raiser��s��
�Or)r�rvr|r}c��tg�yr�rrrr	�	just_callr��s	����Gr)r�rv�c_callr�rxc�.�	ddzy#t$rYywxYw�Nrrr�rrr	�caughtr��s ��
�	�!����
��
�s��	�)r�rvr|r~r{rxc��t�yr)r�rrr	�nested_callr��s��
�Kr)r�rvr�rvrxrxc��eZdZd�Zdd�Zy)�MonitoringEventsBasec���g�tD]2\}}|d��fd�
}tjjt||��4�fd�}tjjtt
j|�tjjtt�g�	|�tjjtd��dd��S#Y�/xYw)N)�
event_namec�(���j|�yr��append)r�r[r#s  �r	�recordz2MonitoringEventsBase.gather_events.<locals>.record�s����
�
�j�)rc�l��t|t�r�jd�y�jd�y)Nr�r�)�
isinstance�PY_CALLABLESr�)�code�offset�obj�argr#s    �r	�record_callz7MonitoringEventsBase.gather_events.<locals>.record_call�s%����#�|�,��
�
�i�(��
�
�h�'rr���)	�
SIMPLE_EVENTSrr"r+r5r_r;r(�SIMPLE_EVENT_SET)r0r`rar�r�r�r#s      @r	�
gather_eventsz"MonitoringEventsBase.gather_events�s������!.��E�:�)3�
*��N�N�,�,�Y��v�F�"/�	(�
	���(�(��A�F�F�K�H����!�!�)�-=�>���	��F�	���!�!�)�Q�/�������
��	��s�"C�CNc�f�|j|�}|�|j}|j||�yr)r�r#r6)r0r`rbr#s    r	�check_eventsz!MonitoringEventsBase.check_events�s1���#�#�D�)�����{�{�H������*rr)r>r?r@r�r�rrr	r�r��s���.+rr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�MonitoringEventsTestc�.�|jt�yr)r�r�r<s r	�test_just_passz#MonitoringEventsTest.test_just_pass�������)�$rc��	|jt�|jtj
j
t�d�y#t$rY�?wxYwr
)r�r�r�r6rr"r'r5r<s r	�test_just_raisez$MonitoringEventsTest.test_just_raisesJ��	����j�)�	
������2�2�9�=�q�A���	��	�s�A�	A�Ac�.�|jt�yr)r�r�r<s r	�test_just_callz#MonitoringEventsTest.test_just_call	r�rc�.�|jt�yr)r�r�r<s r	�test_caughtz MonitoringEventsTest.test_caughts�����&�!rc�.�|jt�yr)r�r�r<s r	�test_nested_callz%MonitoringEventsTest.test_nested_calls�����+�&rN)r>r?r@r�r�r�r�r�rrr	r�r��s��%�B�%�"�'rr�)�testfuncc��eZdZd�Zd�Zy)�SimulateProfileTestc��|jt�}tj|�}|j	|d|d�|j	|d|d|dz�|j	|d|d|dz�y)Nr�r�rvrxr}r|r~)r�r��collectionsr^r6)r0r#�cs   r	�
test_balancedz!SimulateProfileTest.test_balanceds~���#�#�H�-������'������8��a�
�m�4�����7��Q�x�[�1�X�;�%>�?�����7��Q�':�%;�a��k�%I�Jrc������d|_g�g�t����fd�}��fd�}�fd�}tD]'}tjjt||��)tD]'}tjjt||��)tjjttj|�tjjtt�t�tjjtd�|j�g�|j�tj�g�|jt��d�y)Nc���tjd�}�s�jd�y�j�}||k7r�jd|�d|���yy)Nr�emptyz	 Popping z
 expected )r�	_getframer��pop)r[�framerb�errors�stacks   ��r	�upz0SimulateProfileTest.test_frame_stack.<locals>.up%sQ����M�M�!�$�E���
�
�g�&� �9�9�;���H�$��M�M�I�e�W�J�x�j�"I�J�%rc���tjd�}�j|��j|j�yrY)rr�r��add�f_code)r[r��seenr�s  ��r	�downz2SimulateProfileTest.test_frame_stack.<locals>.down-s-����M�M�!�$�E��L�L����H�H�U�\�\�"rc�p��t|t�s%�jtjd��yyrY)r�r�r�rr�)r�r��callabler�r�s    �r	�callz2SimulateProfileTest.test_frame_stack.<locals>.call1s'����h��5����S�]�]�1�-�.�6rr�	)�maxDiff�set�	UP_EVENTSrr"r+r5�DOWN_EVENTSr_r;r(r�r�r6r�r)r0r�r�r�rar�r�r�s     @@@r	�test_frame_stackz$SimulateProfileTest.test_frame_stack s������������u��	K�	#�	/��E��N�N�,�,�Y��r�B�� �E��N�N�,�,�Y��t�D�!����(�(��A�F�F�D�A����!�!�)�-=�>��
����!�!�)�Q�/������$��������� 1�2�����T��A�&rN)r>r?r@r�r�rrr	r�r�s
��K�'rr�c��eZdZd�Zd�Zy)�CounterWithDisablec� �d|_d|_y)NFr)�disablerVr<s r	rWzCounterWithDisable.__init__Cs�������
rc�z�|xjdz
c_|jrtjjSyrY)rVr�rr"r-rZs  r	r\zCounterWithDisable.__call__Gs+���
�
�a��
��<�<��>�>�)�)�)�rNr]rrr	r�r�As���*rr�c��eZdZd�Zd�Zy)�RecorderWithDisablec� �d|_||_y)NF)r�r#�r0r#s  r	rWzRecorderWithDisable.__init__Os�������rc��|jj|�|jrtjj
Syr)r#r�r�rr"r-)r0r�ras   r	r\zRecorderWithDisable.__call__Ss0�������5�!��<�<��>�>�)�)�)�rNr]rrr	r�r�Ms���*rr�c��eZdZd�Zd�Zy)�MontoringDisableAndRestartTestc��	t�}tjjtt
j|�tjjtt
j�|j|jd�d|_	t�|j|jd�d|_d|_	t�|j|jd�d|_	t�|j|jd�tjjtd�tjj�y#tjj�wxYw)NrrT)
r�rr"r+r5r_rgr(r6rVr
r�r,�r0rcs  r	�test_disablez+MontoringDisableAndRestartTest.test_disable[s���	,�(�*�G��N�N�,�,�Y��
�
�G�L��N�N�%�%�i����<����W�]�]�A�.��G�M��D����W�]�]�A�.�"�G�O��G�M��D����W�]�]�A�.��G�M��D����W�]�]�A�.��N�N�%�%�i��3��N�N�)�)�+��C�N�N�)�)�+�s�D=E� E>c��	t�}tjjtt
j|�tjjtt
j�d|_t�d|_
t�|j|jd�tjj�d|_
t�|j|jd�tjjtd�tjj�y#tjj�wxYw)NTrr)
r�rr"r+r5r_rgr(r�r
rVr6r,r�s  r	�test_restartz+MontoringDisableAndRestartTest.test_restartos���	,�(�*�G��N�N�,�,�Y��
�
�G�L��N�N�%�%�i����<�"�G�O��D��G�M��D����W�]�]�A�.��N�N�)�)�+��G�M��D����W�]�]�A�.��N�N�%�%�i��3��N�N�)�)�+��C�N�N�)�)�+�s�DD=�= EN)r>r?r@r�r�rrr	r�r�Ys��,�(,rr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�MultipleMonitorsTestc��	|jtjj�i�t	�}t	�}tjjttj|�tjjttj|�tjjttj�tjjttj�|jtjjt�tj�|jtjjt�tj�|jtjj�ddtzdtzzi�d|_d|_t�|j}|j}|j||fd�tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�y#tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�wxYw)Nrgrr�rr)r6rr"�_all_eventsr�r+r5r_rgrGr(r'rVr
�r0�counter1�counter2�count1�count2s     r	�
test_two_samez"MultipleMonitorsTest.test_two_same�s@��	?����S�^�^�7�7�9�2�>�)�+�H�)�+�H��N�N�,�,�Y��
�
�H�M��N�N�,�,�Z����X�N��N�N�%�%�i����<��N�N�%�%�j�!�*�*�=����S�^�^�6�6�y�A�1�:�:�N����S�^�^�6�6�z�B�A�J�J�O����S�^�^�7�7�9�J��i��\]�ak�\k�Hl�;m�n��H�N��H�N��D��^�^�F��^�^�F����f�f�-�v�6��N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����T�J����S�^�^�7�7�9�2�>��	
�N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����T�J����S�^�^�7�7�9�2�>�s
�HK2�2COc�
�	|jtjj�i�t	�}t	�}t	�}tjjttj|�tjjttj|�tjjttj|�tjjttj�tjjttj�tjjttj�|jtjjt�tj�|jtjjt�tj�|jtjjt�tj�|jtjj�ddtzdtzzdtzzi�d|_
d|_
d|_
t�|j}|j}|j}|j|||fd�tjjtd�tjjtd�tjjtd�tjjttjd�tjjttjd�tjjttjd�|jtjj�i�y#tjjtd�tjjtd�tjjtd�tjjttjd�tjjttjd�tjjttjd�|jtjj�i�wxYw)Nrgrr)rrr)r6rr"r�r�r+r5r_rgrGrHr(r'rVr
)r0r�r��counter3r�r��count3s       r	�test_three_samez$MultipleMonitorsTest.test_three_same�s!��	?����S�^�^�7�7�9�2�>�)�+�H�)�+�H�)�+�H��N�N�,�,�Y��
�
�H�M��N�N�,�,�Z����X�N��N�N�,�,�Z����X�N��N�N�%�%�i����<��N�N�%�%�j�!�*�*�=��N�N�%�%�j�!�*�*�=����S�^�^�6�6�y�A�1�:�:�N����S�^�^�6�6�z�B�A�J�J�O����S�^�^�6�6�z�B�A�J�J�O����S�^�^�7�7�9�J��i��\]�ak�\k�Hl�pq�u�p�IA�<B�
C��H�N��H�N��H�N��D��^�^�F��^�^�F��^�^�F����f�f�f�5�y�A��N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����T�J��N�N�,�,�Z����T�J����S�^�^�7�7�9�2�>��

�N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����T�J��N�N�,�,�Z����T�J����S�^�^�7�7�9�2�>�s
�K!P�D5Uc��	|jtjj�i�t	�}t	�}tjjttj|�tjjttj|�tjjttj�tjjttj�|jtjjt�tj�|jtjjt�tj�|jtjj�dtzdtzd��d|_
d|_
t�|j}|j}|j||fd�tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�y#tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�wxYw)Nr)rgrprr�)r6rr"r�r�r+r5r_rgrGrpr(r'rVr
r�s     r	�test_two_differentz'MultipleMonitorsTest.test_two_different�s;��	?����S�^�^�7�7�9�2�>�)�+�H�)�+�H��N�N�,�,�Y��
�
�H�M��N�N�,�,�Z����h�O��N�N�%�%�i����<��N�N�%�%�j�!�+�+�>����S�^�^�6�6�y�A�1�:�:�N����S�^�^�6�6�z�B�A�K�K�P����S�^�^�7�7�9��Y��ef�jt�et�;u�v��H�N��H�N��D��^�^�F��^�^�F����f�f�-�v�6��N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����d�K����S�^�^�7�7�9�2�>��	
�N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����d�K����S�^�^�7�7�9�2�>�s
�HK0�0COc��	|jtjj�i�t	�}t	�}tjjttj|�tjjttj|�tjjttj�tjjttj�|jtjjt�tj�|jtjjt�tj�|jtjj�ddtzdtzzi�d|_d|_d|_
t�|j}|j}|j||fd�d|_d|_t�|j}|j}|j||fd�tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�tjj�y#tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�tjj�wxYw)NrgrrTr�r)r6rr"r�r�r+r5r_rgrGr(r'rVr�r
r,r�s     r	�test_two_with_disablez*MultipleMonitorsTest.test_two_with_disable�s���	,����S�^�^�7�7�9�2�>�)�+�H�)�+�H��N�N�,�,�Y��
�
�H�M��N�N�,�,�Z����X�N��N�N�%�%�i����<��N�N�%�%�j�!�*�*�=����S�^�^�6�6�y�A�1�:�:�N����S�^�^�6�6�z�B�A�J�J�O����S�^�^�7�7�9�J��i��\]�ak�\k�Hl�;m�n��H�N��H�N�#�H���D��^�^�F��^�^�F����f�f�-�v�6��H�N��H�N��D��^�^�F��^�^�F����f�f�-�v�6��N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����T�J����S�^�^�7�7�9�2�>��N�N�)�)�+��
�N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y��
�
�D�I��N�N�,�,�Z����T�J����S�^�^�7�7�9�2�>��N�N�)�)�+�s
�IM�C<Qc�P�d�}|j}	|jtjj	�i�tjjt|tjtjz�tjjt|tj�tjjtd�tjjtd�|jtjj	�i�y#tjjtd�tjjtd�|jtjj	�i�wxYw)zWTest that the second tool can set events with instruction events set by the first tool.c��yrrrrr	�fz;MultipleMonitorsTest.test_with_instruction_event.<locals>.f�s��rrN)�__code__r6rr"r�r*r5r_�INSTRUCTION�LINErGr()r0r�r�s   r	�test_with_instruction_eventz0MultipleMonitorsTest.test_with_instruction_event�s���	��z�z��	?����S�^�^�7�7�9�2�>��N�N�+�+�I�t�Q�]�]�Q�V�V�=S�T��N�N�+�+�J��a�f�f�E��N�N�%�%�i��3��N�N�%�%�j�!�4����S�^�^�7�7�9�2�>��
�N�N�%�%�i��3��N�N�%�%�j�!�4����S�^�^�7�7�9�2�>�s
�B%D-�-A8F%N)r>r?r@r�r�r�r�r�rrr	r�r��s��?�2?�B?�2,�B
?rr�c�:�eZdZd�Zd�Zd�Zefd�Zd�Zd�Z	d�Z
y)	�LineMonitoringTestc��	|jtjj�i�g}t	|�}tjjttj|�tjjttj�t�tjjtd�tjjttjd�tjjj}|j||dzd|dzg�tjjtd�tjjttjd�|jtjj�i�tjj�y#tjjtd�tjjttjd�|jtjj�i�tjj�wxYw)Nr���)r6rr"r�r�r+r5r_r�r(r
r��test_lines_singler��co_firstlinenor,�r0r#�recorderrvs    r	rz$LineMonitoringTest.test_lines_single
s���	,����S�^�^�7�7�9�2�>��F�*�6�2�H��N�N�,�,�Y�����I��N�N�%�%�i����8��D��N�N�%�%�i��3��N�N�,�,�Y�����E�&�8�8�A�A�P�P�E����V�e�A�g�r�5��7�%;�<��N�N�%�%�i��3��N�N�,�,�Y�����E����S�^�^�7�7�9�2�>��N�N�)�)�+��
�N�N�%�%�i��3��N�N�,�,�Y�����E����S�^�^�7�7�9�2�>��N�N�)�)�+�s
�EG&�&B%Jc�$�	|jtjj�i�g}t	|�}tjjttj|�tjjttj�t�tjjtd�tjjttjd�tjjj}|j||dzddddd|dzg�tjjtd�tjjttjd�|jtjj�i�tjj�y#tjjtd�tjjttjd�|jtjj�i�tjj�wxYw)Nrr��r)r6rr"r�r�r+r5r_r�r(rr��test_lines_loopr�rr,rs    r	r
z"LineMonitoringTest.test_lines_loops���	,����S�^�^�7�7�9�2�>��F�*�6�2�H��N�N�,�,�Y�����I��N�N�%�%�i����8��G��N�N�%�%�i��3��N�N�,�,�Y�����E�&�6�6�?�?�N�N�E����V�e�A�g�r�2�r�2�r�5��7�%K�L��N�N�%�%�i��3��N�N�,�,�Y�����E����S�^�^�7�7�9�2�>��N�N�)�)�+��
�N�N�%�%�i��3��N�N�,�,�Y�����E����S�^�^�7�7�9�2�>��N�N�)�)�+�s
�EG*�*B%Jc�2�	|jtjj�i�g}t	|�}g}t	|�}tjjttj|�tjjttj|�tjjttj�tjjttj�t�tjjtd�tjjtd�tjjttjd�tjjttjd�tjjj}|dzd|dzg}|j||�|j||�tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�tjj!�y#tjjtd�tjjtd�tjjttjd�tjjttjd�|jtjj�i�tjj!�wxYw)Nr�
r�)r6rr"r�r�r+r5r_r�rGr(r
r��test_lines_twor�rr,)r0r#r�events2�	recorder2rvrbs       r	rz!LineMonitoringTest.test_lines_two.sk��	,����S�^�^�7�7�9�2�>��F�*�6�2�H��G�+�G�4�I��N�N�,�,�Y�����I��N�N�,�,�Z�����K��N�N�%�%�i����8�#�.�.�:S�:S�T^�`a�`f�`f�:g��D��N�N�%�%�i��3�S�^�^�5N�5N�z�[\�5]��N�N�,�,�Y�����E��N�N�,�,�Z�����F�&�5�5�>�>�M�M�E��b��"�e�B�h�/�H����V�X�.����W�h�/��N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y�����E��N�N�,�,�Z�����F����S�^�^�7�7�9�2�>��N�N�)�)�+��
�N�N�%�%�i��3��N�N�%�%�j�!�4��N�N�,�,�Y�����E��N�N�,�,�Z�����F����S�^�^�7�7�9�2�>��N�N�)�)�+�s
�HL�C<Pc���	|jtjj�i�g}t	|�}tjj|tj|�tjj|tj�|�tjj|d�tjj|tjd�|ddD�cgc]}||jjz
��}}|j||�tjj|d�ycc}w#tjj|d�wxYw)Nrrr�)r6rr"r�r�r+r_r�r(r�r)r0r`rbrKr#r�line�liness        r	�check_lineszLineMonitoringTest.check_linesHs��	/����S�^�^�7�7�9�2�>��F�*�6�2�H��N�N�,�,�T�1�6�6�8�D��N�N�%�%�d�A�F�F�3��F��N�N�%�%�d�A�.��N�N�,�,�T�1�6�6�4�@�FL�Q�r�l�T�l�d�d�T�]�]�9�9�9�l�E�T����U�H�-��N�N�%�%�d�A�.��U��
�N�N�%�%�d�A�.�s�C5E�7 E�E�E�"E3c�2�d�}|j|gd��y)Nc��d}d}d}d}d}y)Nrrrr�r�rs r	r`z,LineMonitoringTest.test_linear.<locals>.funcZs���D��D��D��D��Dr)rrrrr�r�r0r`s  r	�test_linearzLineMonitoringTest.test_linearXs��	�	
����{�+rc�2�d�}|j|gd��y)Nc�<�djd�rd}d}d}yd}d}y)N�true�trrrrD)�
startswithrs r	r`z,LineMonitoringTest.test_branch.<locals>.funcds-��� � ��%������D����Dr�rrrrDrrs  r	�test_branchzLineMonitoringTest.test_branchcs��	�	
����y�)rc�`�d�}|j|gd��d�}|j|gd��y)Nc�(�	d}d}d}y#d}Yd}yxYw�NrrrrDrrs r	�func1z1LineMonitoringTest.test_try_except.<locals>.func1ps)��
������D��
����D�s�	�r!c�"�	d}d�#d}Yd}yxYwr%rrs r	�func2z1LineMonitoringTest.test_try_except.<locals>.func2zs"��
������
����D�s��)rrrrrrDr)r0r&r(s   r	�test_try_exceptz"LineMonitoringTest.test_try_exceptns0��	�	
����	�*�	�	
����
�.rN)r>r?r@rr
rr5rrr"r)rrr	r�r�s*��,�$,�$,�409�
/� 	,�	*�/rr�c�$�eZdZd�Zd�Zd�Zd�Zy)�TestDisablec#�BK�td�D]
}|rd���
d���y�w)Nrrr�rE)r0�cond�is   r	rzTestDisable.gen�s!�����r��A������	�s�c��	ddzy#�xYwr�rr<s r	�raise_handle_reraisez TestDisable.raise_handle_reraise�s��	�
�a�C��	��s��c�h�tD]�\}}	t�}d|_tjjt||�tjjt|�|jd�D]}�|j|jd�tjjtd�tjjt|d���y#tjjtd�tjjt|d�wxYw)NTrrr)�INSTRUMENTED_EVENTSr�r�rr"r+r5r(r�
assertLessrV)r0ra�namercrs     r	�test_disable_legal_eventsz%TestDisable.test_disable_legal_events�s���.�K�E�4�

I�,�.��"&������0�0��E�7�K����)�)�)�U�;����!��A��%�����
�
�q�1����)�)�)�Q�7����0�0��E�4�H�/�����)�)�)�Q�7����0�0��E�4�H�s
�BC&�&AD1c�x�tD]�\}}	t�}d|_tjjt||�tjjt|�|jt�5|j�ddd�tjjtd�tjjt|d���y#1swY�UxYw#tjjtd�tjjt|d�wxYw)NTr)�
EXCEPT_EVENTSr�r�rr"r+r5r(r7r8r1)r0rar5rcs    r	�test_disable_illegal_eventsz'TestDisable.test_disable_illegal_events�s���(�K�E�4�	
I�,�.��"&������0�0��E�7�K����)�)�)�U�;��&�&�z�2��-�-�/�3����)�)�)�Q�7����0�0��E�4�H�)�3�2�����)�)�)�Q�7����0�0��E�4�H�s%�A/C.�=C"�C.�"C+	�'C.�.AD9N)r>r?r@rr1r6r9rrr	r+r+�s����I�Irr+c�0�eZdZejZd�Zd�Zy)�ExceptionRecorderc��||_yr�r#r�s  r	rWzExceptionRecorder.__init__��	����rc�P�|jjdt|�f�y)Nr|�r#r��type�r0r�r��excs    r	r\zExceptionRecorder.__call__���������G�T�#�Y�/�0rN)r>r?r@r_�RAISE�
event_typerWr\rrr	r;r;�s�����J��1rr;c�&�eZdZd�Zeeffd�Zd�Zy)�CheckEventsc�.�	|jtjj�i�g}d}|D]:}|j}tjj||||��||z}�<tjj
||�|�tjj
|d�|D]-}tjj||jd��/|tjj
|d�|D]-}tjj||jd��/S#tjj
|d�|D]-}tjj||jd��/wxYwr
)r6rr"r�rFr+r()r0r`rK�	recorders�
event_list�
all_eventsr�evs        r	r'zCheckEvents.get_events�s9��	R����S�^�^�7�7�9�2�>��J��J�%���(�(�����0�0��r�8�J�;O�P��b� �
�&�
�N�N�%�%�d�J�7��F��N�N�%�%�d�A�.�%�����0�0��x�7J�7J�D�Q�&���N�N�%�%�d�A�.�%�����0�0��x�7J�7J�D�Q�&��
�N�N�%�%�d�A�.�%�����0�0��x�7J�7J�D�Q�&�s
�C+E�AFc��|j|||�}||k7rt|tj��|j	||�y)N)�file)r'�printr�stderrr6)r0r`rbrKrJr#s      r	r�zCheckEvents.check_events�s:������t�Y�7���X���&����,������*rc�:�|j|t|�}|jt|�dzd�t	|ddd�|ddd��D]K\}}|d}|j|d�|d}|j|d�|j|d|d��My)Nrrr)r|�reraise)�handledr})r'r5r6r�zip�assertIn)r0r`rJr#�r�h�r0�h0s        r	�check_balancedzCheckEvents.check_balanced�s�������y�)�<������V��Q���*���s��s��F�1�4�a�4�L�1�D�A�q��1��B��M�M�"�2�3��1��B��M�M�"�3�4����Q�q�T�1�Q�4�(�2rN)r>r?r@r'r5r;r�r[rrr	rHrH�s��R�(1:�FW�EY�+�)rrHc�$�eZdZejZy)�StopiterationRecorderN)r>r?r@r_�STOP_ITERATIONrFrrr	r]r]�s
���!�!�Jrr]c�*�eZdZejZd�Zy)�ReraiseRecorderc�P�|jjdt|�f�y)NrSr@rBs    r	r\zReraiseRecorder.__call__���������I�t�C�y�1�2rN)r>r?r@r_�RERAISErFr\rrr	r`r`�s�����J�3rr`c�*�eZdZejZd�Zy)�UnwindRecorderc�P�|jjdt|�f�y)Nr}r@rBs    r	r\zUnwindRecorder.__call__�s�������H�d�3�i�0�1rN)r>r?r@r_�	PY_UNWINDrFr\rrr	rere�s�����J�2rrec�*�eZdZejZd�Zy)�ExceptionHandledRecorderc�P�|jjdt|�f�y)NrTr@rBs    r	r\z!ExceptionHandledRecorder.__call__�rbrN)r>r?r@r_�EXCEPTION_HANDLEDrFr\rrr	riri�s���$�$�J�3rric�*�eZdZejZd�Zy)�
ThrowRecorderc�P�|jjdt|�f�y)N�throwr@rBs    r	r\zThrowRecorder.__call__�rDrN)r>r?r@r_�PY_THROWrFr\rrr	rmrm�s�����J�1rrmc�n�eZdZeeeefZd�Zd�Z	de
fde
fgZde
fde
fgZd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zy
)�ExceptionMonitoringTestc�<�d�}|j|dtfg�y)Nc�*�	d}t�#d}Yd}yxYw�NrrrD��KeyErrorrs r	r&z=ExceptionMonitoringTest.test_simple_try_except.<locals>.func1
�"��
������
����D���
�r|)r�rw�r0r&s  r	�test_simple_try_exceptz.ExceptionMonitoringTest.test_simple_try_excepts!��	�	
���%�7�H�"5�!6�7rc�V��d���fd�}|j|dtfgtf��y)Nc3�K�d��y�w�Nrrrrrr	rzAExceptionMonitoringTest.test_implicit_stop_iteration.<locals>.gens�����G��s�c�����D]}�yrr)rrs �r	�implicit_stop_iterationzUExceptionMonitoringTest.test_implicit_stop_iteration.<locals>.implicit_stop_iterations����U���rr|�rJ)r��
StopIterationr])r0r�rs  @r	�test_implicit_stop_iterationz4ExceptionMonitoringTest.test_implicit_stop_iterations1���	�	�	
���1�W�m�4L�3M�Zo�Yq��rrr|rTrSc�D�d�}|j||j��y)Nc�,�		ddzy#�xYw#YyxYwr�rrrr	r`z;ExceptionMonitoringTest.test_explicit_reraise.<locals>.func/s&��
���a�C�����
��s�	���r��r[�exception_recordersrs  r	�test_explicit_reraisez-ExceptionMonitoringTest.test_explicit_reraise-�(��	�	
�����0�0�	�	2rc�D�d�}|j||j��y)Nc�D�		ddzy#t$r}�d}~wwxYw#YyxYwr�r���exs r	r`zAExceptionMonitoringTest.test_explicit_reraise_named.<locals>.func>s/��
���a�C�� ������
��s�	�	����r�r�rs  r	�test_explicit_reraise_namedz3ExceptionMonitoringTest.test_explicit_reraise_named<r�rc�D�d�}|j||j��y)Nc�>�		ddzy#t$rYywxYw#YyxYwr��r8rrr	r`z;ExceptionMonitoringTest.test_implicit_reraise.<locals>.funcMs.��
���a�C��!�����
��s�	�	����r�r�rs  r	�test_implicit_reraisez-ExceptionMonitoringTest.test_implicit_reraiseKr�rc�D�d�}|j||j��y)Nc�L�		ddzy#t$r
}Yd}~yd}~wwxYw#YyxYwr�r�r�s r	r`zAExceptionMonitoringTest.test_implicit_reraise_named.<locals>.func]s/��
���a�C��!������
��s�	�	����#r�r�rs  r	�test_implicit_reraise_namedz3ExceptionMonitoringTest.test_implicit_reraise_named[r�rc�D�d�}|j||j��y)Nc�*�		ddzy#wxYw#YyxYwr�rrrr	r`z6ExceptionMonitoringTest.test_try_finally.<locals>.funcls#��
���a�C���D��
��s�	���r�r�rs  r	�test_try_finallyz(ExceptionMonitoringTest.test_try_finallyjr�rc�D�d�}|j||j��y)Nc�b��d���fd�}	|�jd�y#t$rYywxYw)Nc�6K�td�D]}t�y�wrY)rE�ZeroDivisionError)r/s r	�async_generatorzMExceptionMonitoringTest.test_async_for.<locals>.func.<locals>.async_generator}s�����q��A�+�+�"�s�c��V�K�	��23d{���}�
7�6y#t$rYywxYw�wrr�)rr�s �r	�
async_loopzHExceptionMonitoringTest.test_async_for.<locals>.func.<locals>.async_loop�s6������&5�&7��d����&7�� ����s4�)��������)�	&�)�&�))�sendr�)r�r�s @r	r`z4ExceptionMonitoringTest.test_async_for.<locals>.func{s4���
�

�
���!�!�$�'�� �
��
�s�"�	.�.r�r�rs  r	�test_async_forz&ExceptionMonitoringTest.test_async_forys(��	�&	
�����0�0�	�	2rc����d���fd�}|j||j��|j|t|jtfz�}|j|ddtf�y)Nc3�K�d��d��y�wr~rrrr	rz/ExceptionMonitoringTest.test_throw.<locals>.gen�s�����G��G�rc�t��	��}t|�|jt�y#t$rYywxYwr)�nextro�
IndexError)�grs �r	r`z0ExceptionMonitoringTest.test_throw.<locals>.func�s4���
��E���Q�����
�#���
��
�s�'+�	7�7r�rro)r[r�r'r5rmr6r�)r0r`r#rs   @r	�
test_throwz"ExceptionMonitoringTest.test_throw�sp���	�	�	
�����0�0�	�	2�������$�$�
�'7�7�
��
	
������W�j�$9�:rN)r>r?r@r;r`rirer�r{r�r��initialrSr�r�r�r�r�r�r�rrr	rrrrs|��	�� ��	��
8�
s�
�#�$�	�%�&��G�
�%�&�	�%�&��G�

2�
2�
2� 
2�
2�2�2;rrrc�0�eZdZejZd�Zd�Zy)�LineRecorderc��||_yrr=r�s  r	rWzLineRecorder.__init__�r>rc�n�|jjd|j||jz
f�y)Nr)r#r��co_namer)r0r�rs   r	r\zLineRecorder.__call__�s*�������F�D�L�L�$��9L�9L�2L�M�NrN)r>r?r@r_r�rFrWr\rrr	r�r��s�����J��Orr�c�0�eZdZejZd�Zd�Zy)�CallRecorderc��||_yrr=r�s  r	rWzCallRecorder.__init__�r>rc�T�|jjd|j|f�y)Nr�)r#r�r>�r0r�r�r`r�s     r	r\zCallRecorder.__call__�s�������F�D�M�M�3�7�8rN)r>r?r@r_r;rFrWr\rrr	r�r��s�����J��9rr�c��eZdZd�Zd�Zy)�CEventRecorderc��||_yrr=r�s  r	rWzCEventRecorder.__init__�r>rc�h�|jj|j|j|f�yr)r#r�r�r>r�s     r	r\zCEventRecorder.__call__�s#�������D�O�O�T�]�]�C�@�ArNr]rrr	r�r��s
���Brr�c�(�eZdZejZdZy)�CReturnRecorder�C returnN)r>r?r@r_r9rFr�rrr	r�r��s�����J��Jrr�c�(�eZdZejZdZy)�CRaiseRecorder�C raiseN)r>r?r@r_r:rFr�rrr	r�r��s�����J��Jrr�c��eZdZd�Zd�Zd�Zy)�TestManyEventsc�~�d�}|j|tdddtjjfddddd	g�
�y)Nc��d}d}d}y�Nrrrr��line1�line2�line3s   r	r&z)TestManyEvents.test_simple.<locals>.func1�����E��E��Er�rr'rr�r&�rr&r�rr&r�rr&r�rr'r
�r�r(r�rJrb�r��MANY_RECORDERSrr"r.rzs  r	�test_simplezTestManyEvents.test_simple�sJ��	�
	
���%�^�&�
�W�c�n�n�4�4�5� � � �&�%�I'��	(rc
��d�}|j|tdddtjjfdddddgfd	ddgfd
ddg	�
�y)Nc�.�d}gjd�d}yr�r��r�r�s  r	r(z)TestManyEvents.test_c_call.<locals>.func2�����E��I�I�a�L��Err�r�r(�rr(r�rr(rr�rr��rr(rr�r�r�r��r0r(s  r	�test_c_callzTestManyEvents.test_c_call�sb��	�
	
���%�^�&�
�W�c�n�n�4�4�5� � �
�X��s�#�
��A�3�'� �&�%�	I'��		(rc��d�}|j|tdddtjjfddddt
fd	d
ddd
g��y)Nc�*�	d}t�#d}Yd}yxYwrurvrs r	�func3z-TestManyEvents.test_try_except.<locals>.func3�rxryr�r�r��rr�r�rr�r�rr�rr|�rr�r�rr�r�rr�rDr�r�r�)r�r�rr"r.rw�r0r�s  r	r)zTestManyEvents.test_try_except�s[��	�	
���%�^�&�
�W�c�n�n�4�4�5� � � �
�h�� � � �&�%�I'��	(rN)r>r?r@r�r�r)rrr	r�r��s��(� (�$(rr�c�0�eZdZejZd�Zd�Zy)�InstructionRecorderc��||_yrr=r�s  r	rWzInstructionRecorder.__init__r>rc�t�|jdk7r)|jjd|j|f�yy)Nr'�instruction)r�r#r�)r0r�r�s   r	r\zInstructionRecorder.__call__s0���<�<�<�'��K�K���
�t�|�|�V�D�E�(rN)r>r?r@r_r�rFrWr\rrr	r�r�s�����J��Frr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�TestLineAndInstructionEventsNc�>�d�}|j|tgd���y)Nc��d}d}d}yr�rr�s   r	r&z7TestLineAndInstructionEvents.test_simple.<locals>.func1#r�r�r�r��r�r&r�r�r&rr��r�r&rD)r�r&rr�)r�r&r)r�r&�)r�r&�r�r��r��LINE_AND_INSTRUCTION_RECORDERSrzs  r	r�z(TestLineAndInstructionEvents.test_simple!s%��	�
	
���%�-K�Y(��	)rc�>�d�}|j|tgd���y)Nc�.�d}gjd�d}yr�r�r�s  r	r(z7TestLineAndInstructionEvents.test_c_call.<locals>.func28r�r)r�r��r�r(r)r�r(rr�)r�r(rD)r�r(r)r�r(�)r�r(�)r�r(�&r�)r�r(�()r�r(�*)r�r(�,r�r�r�r�s  r	r�z(TestLineAndInstructionEvents.test_c_call6s%��	�
	
���%�-K�Y(��	)rc�>�d�}|j|tgd���y)Nc�*�	d}t�#d}Yd}yxYwrurvrs r	r�z;TestLineAndInstructionEvents.test_try_except.<locals>.func3Prxry)r�r�)r�r�rr�)r�r�r)r�r�rDr�)r�r�r)r�r��)r�r��r�)r�r��r�)r�r�r	)r�r��)r�r�r�r�)r�r�r�)r�r�� )r�r��"r�r�r�r�s  r	r)z,TestLineAndInstructionEvents.test_try_exceptNs%��	�	
���%�-K�Y(��	)rc��d�}|j|tgd���tjj	�|j|tgd���y)Nc��d}d}d}yr�rr�s   r	r&z=TestLineAndInstructionEvents.test_with_restart.<locals>.func1pr�rr�r�)r�r�rr"r,rzs  r	�test_with_restartz.TestLineAndInstructionEvents.test_with_restartosS��	�
	
���%�-K�Y(��	)�	���%�%�'����%�-K�Y(��	)r)r>r?r@r�r�r�r)r	rrr	r�r�s���G�)�*)�0)�B")rr�c��eZdZeeffd�Zed��Zgd�Zd�Z	d�Z
ed��Zddd	ejjfd
ddgZd
�Zd�Zy)�TestInstallIncrementallyc�~�	|jtjj�i�g}d}|D]1}||jz}tjj||��3|D]3}tjj
||j||���5|�tjj|d�|D]-}tjj
||jd��/|D]}|j||��	tjj|d�|D]-}tjj
||jd��/y#tjj|d�|D]-}tjj
||jd��/wxYwr
)r6rr"r�rFr(r+rV)	r0r`�must_includerKrJrKrLrrs	         r	r�z%TestInstallIncrementally.check_events�s\��	R����S�^�^�7�7�9�2�>��J��J�%���h�1�1�1�
����)�)�$�
�;�&�&�����0�0��x�7J�7J�H�U_�L`�a�&��F��N�N�%�%�d�A�.�%�����0�0��x�7J�7J�D�Q�&�$���
�
�d�J�/�%�
�N�N�%�%�d�A�.�%�����0�0��x�7J�7J�D�Q�&��
�N�N�%�%�d�A�.�%�����0�0��x�7J�7J�D�Q�&�s
�DE(�(AF<c��d}yrYr)r�s r	r&zTestInstallIncrementally.func1�s���r)r�r�r�r�c�l�ttg}|j|j||j��y�N)rJr
)r�r�r�r&�MUST_INCLUDE_LI�r0rJs  r	�test_line_then_instructionz3TestInstallIncrementally.test_line_then_instruction��2��"�$7�9�	����$�*�*�&/��@T�@T�	�	Vrc�l�ttg}|j|j||j��yr)r�r�r�r&rrs  r	�test_instruction_then_linez3TestInstallIncrementally.test_instruction_then_line��1��)�<�9�	����$�*�*�&/��@T�@T�	�	Vrc��td�y)Nrr�rrr	r(zTestInstallIncrementally.func2�s	���B�rr�r�r()r�rr)r�r(r�)r�r(r�c�l�ttg}|j|j||j��yr)r�r�r�r(�MUST_INCLUDE_CIrs  r	�test_call_then_instructionz3TestInstallIncrementally.test_call_then_instruction�rrc�l�ttg}|j|j||j��yr)r�r�r�r(rrs  r	�test_instruction_then_callz3TestInstallIncrementally.test_instruction_then_call�rrN)r>r?r@r5r;r��staticmethodr&rrrr(rr"r.rrrrrr	rr�s���4=�J[�I]�R�*����)�O�V�
V�
����
(�
�W�c�n�n�4�4�5��(�(�*�O�V�
Vrrc�0�eZdZedfd�Zd�Zd�Zd�Zd�Zy)�TestLocalEventsrc��	|jtjj�i�g}d}|D]:}|j}tjj||||��||z}�<tjj
||j|�|�tjj
||jd�|D]-}tjj||jd��/|j||�tjj
||jd�|D]-}tjj||jd��/y#tjj
||jd�|D]-}tjj||jd��/wxYwr
)r6rr"r�rFr+r*r�)	r0r`rbrKrJrKrLrrMs	         r	r�zTestLocalEvents.check_events�s^��	R����S�^�^�7�7�9�2�>��J��J�%���(�(�����0�0��r�8�J�;O�P��b� �
�&�
�N�N�+�+�D�$�-�-��L��F��N�N�+�+�D�$�-�-��C�%�����0�0��x�7J�7J�D�Q�&����Z��2��N�N�+�+�D�$�-�-��C�%�����0�0��x�7J�7J�D�Q�&��
�N�N�+�+�D�$�-�-��C�%�����0�0��x�7J�7J�D�Q�&�s
�DE2�2AGc�>�d�}|j|tgd���y)Nc��d}d}d}yr�rr�s   r	r&z*TestLocalEvents.test_simple.<locals>.func1�r�r)r�r�r�r��r��LOCAL_RECORDERSrzs  r	r�zTestLocalEvents.test_simple�s$��	�
	
���%�_�J"��	#rc
�T�d�}|j|tdddddgfdddgfdg�	�y)
Nc�.�d}gjd�d}yr�r�r�s  r	r(z*TestLocalEvents.test_c_call.<locals>.func2�r�rr�r�r�r�rr�r�r�r$r�s  r	r�zTestLocalEvents.test_c_call�sE��	�
	
���%�_� � �
�X��s�#�
��A�3�'� �J"��	#rc�>�d�}|j|tgd���y)Nc�*�	d}t�#d}Yd}yxYwrurvrs r	r�z.TestLocalEvents.test_try_except.<locals>.func3
rxry)r�r�r�r�r�r�r�r$r�s  r	r)zTestLocalEvents.test_try_excepts$��	�	
���%�_�J"��	#rc���|jt�5tjj	t
tjtj�ddd�y#1swYyxYwr)
r7r8rr"r*r5r�r�r_rEr<s r	�test_set_non_local_eventz(TestLocalEvents.test_set_non_local_events<��
�
�
�z�
*��N�N�+�+�I�y�7I�7I�1�7�7�S�+�
*�
*�s�AA!�!A*N)	r>r?r@r5r�r�r�r)r+rrr	r r �s"��09�R�R�*
#�#�#�$Trr c��|j�D]/\}}}||cxkr|ks�n�|�d|�d�cS||jz
cSy)Nz[offset=�]r�)�co_linesr)r�r�rv�endrs     r	�line_from_offsetr0sP�� �M�M�O���s�D��F� �S� ��|�!�&���+�+��$�-�-�-�-�	,�
rc�4�eZdZejZdZd�Zd�Zy)�JumpRecorderrzc��||_yrr=r�s  r	rWzJumpRecorder.__init__+r>rc��t||�}t||�}|jj|j|j||f�yr)r0r#r�r5r�)r0r��from_�to�	from_line�to_lines      r	r\zJumpRecorder.__call__.s=��$�T�5�1�	�"�4��,�������D�I�I�t�|�|�Y��H�IrN)	r>r?r@r_�JUMPrFr5rWr\rrr	r2r2&s�����J��D��Jrr2c�(�eZdZejZdZy)�BranchRecorderr{N)r>r?r@r_�BRANCHrFr5rrr	r;r;4s�����J��Drr;c�0�eZdZejZd�Zd�Zy)�ReturnRecorderc��||_yrr=r�s  r	rWzReturnRecorder.__init__=r>rc�>�|jjd|f�y)Nrx)r#r�)r0r�r��vals    r	r\zReturnRecorder.__call__@s�������H�c�?�+rN)r>r?r@r_rprFrWr\rrr	r>r>9s�����J��,rr>c��eZdZdZd�Zd�Zy)�TestBranchAndJumpEventsNc�r�d�}|j|tgd���|j|tgd���y)Nc�6�d}td�D]	}|rd}�d}�y)NrrrrDr-)�x�as  r	r`z/TestBranchAndJumpEvents.test_loop.<locals>.funcMs"���A��1�X����A��A�	r)�r{r`rr�r{r`rrD�rzr`rDrrH�r{r`rr�rzr`rrrHr�)r��rr`r�rr`rrH�rr`rrI)rr`rDrJrNrHrOrK�rr`rrLrNrHr�)r��JUMP_AND_BRANCH_RECORDERS�JUMP_BRANCH_AND_LINE_RECORDERSrs  r	�	test_loopz!TestBranchAndJumpEvents.test_loopKsC��	�	
���$�,E�S&��	'�	
���$�,J�X(��	)rc���Gd�d���fd�}|j|tgd���|j|tdddd	d
tfddd
dddddddg��y)Nc��eZdZd�Zy)�5TestBranchAndJumpEvents.test_except_star.<locals>.Fooc��yrrr<s r	�methz:TestBranchAndJumpEvents.test_except_star.<locals>.Foo.methts��rN)r>r?r@rXrrr	�FoorVss��
rrYc���		t�#gxt%x�#}��}|j�d}~nd}~�nn��x�YycYwxYw#t$rYywxYwr)rwr�rX)�er�rYs  �r	r`z6TestBranchAndJumpEvents.test_except_star.<locals>.funcwsK���
�(�"�N��(�	�(���A�q�v�v�x�x��x�(����
��
�s)�
�A�1	�A�A�A�	A�A)r�rMrNrOrP�r{r`rr�rr`r�rrXr�rzr`rr�rzr`rz[offset=114]�r{r`z[offset=120]z[offset=122]r�r�r�rMrNrOr|rPr\r]r^)rxNr_r`rar�)r�rR�FLOW_AND_LINE_RECORDERSrw)r0r`rYs  @r	�test_except_starz(TestBranchAndJumpEvents.test_except_starqs����	�	�	�	
���$�,J�X(��	)�	
���$�,C�&����
�h���$����"�/�>��&�Q(��	)r)r>r?r@r�rSrcrrr	rCrCHs���G�$)�L-)rrCc�\�eZdZeeeefZd�Zdd�Z	d�Z
dd�Zd�Zdd�Z
d�Zdd�Zd	�Zd
�Zy)
�TestLoadSuperAttrc�$�i}t|||�|Sr)�exec)r0�co�ds   r	�_execzTestLoadSuperAttr._exec�s�����R��A���rc��|rdnd}|�dtj|���}t|dd�}|j|j	|�|�|j|�S)Nzx = 1z
super = super�
�<string>rg)�textwrap�dedent�compiler6�_has_load_super_attrrj)r0�codestr�	optimized�
assignmentrhs     r	�_exec_superzTestLoadSuperAttr._exec_super�s^��!*�W��
��L��8�?�?�7�#;�"<�=��
�W�j�&�
1������2�2�2�6�	�B��z�z�"�~�rc���td�tj|�D��}|st�fd�|jD��}|S)Nc3�:K�|]}|jdk(���y�w)�LOAD_SUPER_ATTRN)�opname)�.0�instrs  r	�	<genexpr>z9TestLoadSuperAttr._has_load_super_attr.<locals>.<genexpr>�s����Z�AY��%�,�,�"3�3�AY�s�c3�x�K�|]1}t|tj�xr�j|����3y�wr)r��types�CodeTyperq)rzr�r0s  �r	r|z9TestLoadSuperAttr._has_load_super_attr.<locals>.<genexpr>�s7������%�A��1�e�n�n�-�N�$�2K�2K�A�2N�N�%�s�7:)�any�dis�get_instructions�	co_consts)r0rh�hass`  r	rqz&TestLoadSuperAttr._has_load_super_attr�sD����Z��AU�AU�VX�AY�Z�Z����������C��
rc��d}|j||�}dddtjjfddd|dfddd	tjjfd
d	tjjfdddd
ddddg}|d|fS)Na[
            class A:
                def method(self, x):
                    return x

            class B(A):
                def method(self, x):
                    return super(
                    ).method(
                        x
                    )

            b = B()
            def f():
                return b.method(1)
        r�r�r��rr�r�method�b�rr�r�superr��rr�r�rr�r)r�r�rr�r��rurr"r.�r0rsrrrirbs     r	�_super_method_callz$TestLoadSuperAttr._super_method_call�s����� 
���W�i�0��&�
�S�#�.�.�0�0�1��
�X�q��v�&�!�
�W�c�n�n�4�4�5�
��#�.�.�"8�"8�9�!�!�!�!�!�!�&�%�
��"��v�x��rc���|jd��\}}|jd��\}}|j||j|��|j||j|��y�NF)rsTr�)r�r��	RECORDERS�r0�nonopt_func�nonopt_expected�opt_func�opt_expecteds     r	�test_method_callz"TestLoadSuperAttr.test_method_call�sd��'+�'>�'>��'>�'O�$��_�!%�!8�!8�4�!8�!H���,����+����/��Z����(�d�n�n�|��Trc��d}|j||�}dddtjjfdddd|dfd	d
dd	dd
ddddg}|d|fS)Na?
            class A:
                def method(self, x):
                    return x

            class B(A):
                def method(self, x):
                    return super(
                        x,
                        self,
                    ).method(
                        x
                    )

            b = B()
            def f():
                try:
                    return b.method(1)
                except TypeError:
                    pass
                else:
                    assert False, "should have raised TypeError"
        r�r�r�r�)rr�rr�r�r�r�r�)r�r�r)r�r�r)rr�r)rr�rr�r�r�r�s     r	�_super_method_call_errorz*TestLoadSuperAttr._super_method_call_error�s~����.
���W�i�0��&�
�S�#�.�.�0�0�1���
�X�q��v�&�!�!�!�!� �#���&�%�
��"��v�x��rc���|jd��\}}|jd��\}}|j||j|��|j||j|��yr�)r�r�r�r�s     r	�test_method_call_errorz(TestLoadSuperAttr.test_method_call_errorsd��'+�'D�'D�u�'D�'U�$��_�!%�!>�!>��!>�!N���,����+����/��Z����(�d�n�n�|��Trc��d}|j||�}dddtjjfddd|dfddd	tjjfd
d	tjjfdddd
g}|d|fS)Nz�
            class A:
                x = 1

            class B(A):
                def method(self):
                    return super(
                    ).x

            b = B()
            def f():
                return b.method()
        r�r�r�r�r�r�r�r�r�r�r�r�r�r�s     r	�_super_attrzTestLoadSuperAttr._super_attrs�����
���W�i�0��&�
�S�#�.�.�0�0�1��
�X�q��v�&�!�
�W�c�n�n�4�4�5�
��#�.�.�"8�"8�9�!�!�&�%�
����v�x��rc���|jd��\}}|jd��\}}|j||j|��|j||j|��yr�)r�r�r�r�s     r	�	test_attrzTestLoadSuperAttr.test_attr<sd��'+�'7�'7�%�'7�'H�$��_�!%�!1�!1�D�!1�!A���,����+����/��Z����(�d�n�n�|��Trc�*�tjd�}d�}dD]�}|j|��5|rdnd}|jd|��}|jd	|��}t	|d
d�}|j|j
|��|j|�}|j|�}	|j|d|j|d||��
�|j|	d|j|d	||	��
�ddd���y#1swY��xYw)Nz�
            class C:
                def method(self):
                    return {cls}().__repr__{call}
            c = C()
            def f():
                return c.method()
        c	�(�|dk(rdntjj}dddtjjfddd|dfd	d|tjjfd
|tjjfg|r
dd|fd
d|fgng�d�d
�S)N�intrr�r�r�r�r�r�r�r��__repr__r�r�)rr"r.)r5�call_method�ns�repr_args    r	�get_expectedz?TestLoadSuperAttr.test_vs_other_type_call.<locals>.get_expectedMs��� �E�M�q�s�~�~�/E�/E�H�*���c�n�n�4�4�5� ���2�c�7�+�%���s�~�~�5�5�6��T�3�>�>�#9�#9�:��%� ��X�6�#�Z��:��+-��+��*��
r)TF)r�z()�r�)�clsr�r�rmrgr�r�)
rnro�subTest�formatrp�
assertTruerqrjr�r�)
r0�
code_templater�r��call_str�
code_super�code_int�co_super�ns_super�ns_ints
          r	�test_vs_other_type_callz)TestLoadSuperAttr.test_vs_other_type_callCs�� ���)�
�
�	�()�K����+��6�#.�4�B��*�1�1�g�H�1�M�
�(�/�/�E��/�I��"�:�z�6�B������ 9� 9�(� C�D��:�:�h�/�����H�-���!�!��S�M�"�n�n�)�'�;��I�"��
�!�!��3�K�"�n�n�)�%��f�E�"��7�6�)�6�6�s�CD	�	D	N)F)r>r?r@r�r�r�r�r�rjrurqr�r�r�r�r�r�r�rrr	rere�sG���l�N�O�K�I��
��# �JU�* �XU� �<U�1rrec��eZdZd�Zd�Zy)�TestSetGetEventsc�,�tjjttj
�|j
tjjt�tj
�tjjttj
�|j
tjjt�tj
�tjjtd�|j
tjjt�d�tjjtd�|j
tjjt�d�yr
)	rr"r(r5r_rgr6r'rGr<s r	�test_globalzTestSetGetEvents.test_globalys������!�!�)�Q�Z�Z�8�������2�2�9�=�q�z�z�J����!�!�*�a�j�j�9�������2�2�:�>��
�
�K����!�!�)�Q�/�������2�2�9�=�q�A����!�!�*�Q�/�������2�2�:�>��Brc�\�tj}tjj	t
|tj�|jtjjt
|�tj�tjj	t|tj�|jtjjt|�tj�tjj	t
|d�|jtjjt
|�d�tjj	t|d�|jtjjt|�d�yr
)r
r�rr"r*r5r_rgr6r)rG)r0r�s  r	�
test_localzTestSetGetEvents.test_local�s����{�{�����'�'�	�4����D�������8�8��D�I�1�:�:�V����'�'�
�D�!�*�*�E�������8�8��T�J�A�J�J�W����'�'�	�4��;�������8�8��D�I�1�M����'�'�
�D�!�<�������8�8��T�J�A�NrN)r>r?r@r�r�rrr	r�r�ws��C�	Orr�c�"�eZdZed��Zd�Zy)�TestUninitializedc��yrrrrr	r�zTestUninitialized.f�s��rc��|jtjjt|j
j�d�yr
)r6rr"r)r5r�r�r<s r	�#test_get_local_events_uninitializedz5TestUninitialized.test_get_local_events_uninitialized�s,��������8�8��D�F�F�O�O�T�VW�XrN)r>r?r@rr�r�rrr	r�r��s���
��
�Yrr�c�$�eZdZd�Zd�Zd�Zd�Zy)�TestRegressionsc�����d��fd����fd���fd�}|�|j�d�d�	tjjtt
j�|�|j�d�tjjtd�y#tjjtd�wxYw)Nc3�B�K�	d��y#t$r	d�d��YywxYw�w)N�innerr�)r�s�r	r�z*TestRegressions.test_105162.<locals>.inner�s%�����
����
� ���
�s��
�����c3�\�K�	��Ed{���y7�#t$r	d�d��YywxYw�w)N�outerr�)r�r�s��r	r�z*TestRegressions.test_105162.<locals>.outer�s-�����
� �7�"�"���
� ���
�s(�,�
���,��)�,�)�,c�`����}|jd�|jt�yr)r�ror�)rr�s �r	�runz(TestRegressions.test_105162.<locals>.run�s!����'�C��H�H�T�N��I�I�i� rr�r)r6rr"r(r5r_rl)r0r�r�r�r�s  @@@r	�test_105162zTestRegressions.test_105162�s������	�	�	!�	�������)���	4��N�N�%�%�i����=��E����V�W�-��N�N�%�%�i��3��C�N�N�%�%�i��3�s�AB"�"&Cc����Gd�d���fd�}	|�tjjtd�y#tjjtd�wxYw)Nc��eZdZd�Zy)�(TestRegressions.test_108390.<locals>.Fooc�n�|r3tjjttj
�yyr)rr"r(r5r_rl)r0�	set_events  r	rWz1TestRegressions.test_108390.<locals>.Foo.__init__�s"����N�N�-�-�i����E�rN)r>r?r@rWrrr	rYr��s��
FrrYc�<��td�D]
}�|dk(��y)N�d�cr-)r/rYs �r	�!make_foo_optimized_then_set_eventzFTestRegressions.test_108390.<locals>.make_foo_optimized_then_set_event�s����3�Z���A��G�� rr)rr"r(r5)r0r�rYs  @r	�test_108390zTestRegressions.test_108390�sH���	F�	F�
	�	4�-�/��N�N�%�%�i��3��C�N�N�%�%�i��3�s	�>�&A$c�V�tjjdd�|jtjjd�tjjdd�tjj
dtjd��tjj
dtjd��tjjdtjtjz�tjjdd�y)Nr�testc�B�tjjdd�Sr
)rr"r(�r[s r	�<lambda>z/TestRegressions.test_gh108976.<locals>.<lambda>�s��#�.�.�B[�B[�\]�_`�Barc��yr
rr�s r	r�z/TestRegressions.test_gh108976.<locals>.<lambda>�s��r)
rr"r$�
addCleanupr%r(r+r_r�r�r<s r	�
test_gh108976zTestRegressions.test_gh108976�s������"�"�1�f�-�������3�3�Q�7����!�!�!�Q�'����(�(��A�F�F�4a�b����(�(��A�M�M�?�K����!�!�!�Q�V�V�a�m�m�%;�<����!�!�!�Q�'rc���dd�}d}g}g�tjjdd�|jtjjd�tjjdd�tjj
dtj�fd��tjjdtj�||�||�tjjdd�|j�d|df�|j�d|tjjf�y)Nrc��||zSrr)rGr�s  r	r�z0TestRegressions.test_call_function_ex.<locals>.f�s���q�5�Lr)rrrr�c�*���j||f�Srr�)r�r�r��arg0�	call_datas    �r	r�z7TestRegressions.test_call_function_ex.<locals>.<lambda>�s���Yb�Yi�Yi�ks�uy�jz�Y{r)rr"r$r�r%r(r+r_r;r6r.)r0r�r[�
empty_argsr�s    @r	�test_call_function_exz%TestRegressions.test_call_function_ex�s����	����
��	����"�"�1�f�-�������3�3�Q�7����!�!�!�Q�'����(�(��A�F�F�4{�|����!�!�!�Q�V�V�,�	�4��	�:�����!�!�!�Q�'�����1���1�v�.�����1���3�>�>�+A�+A�'B�CrN)r>r?r@r�r�r�r�rrr	r�r��s��4�B4� (�Drr�)b�__doc__r�r��	functools�operatorrrnr~�unittest�asynciorr
rrrrr5rGrH�TestCaser rBrPr"r#r_rgrlrp�PY_YIELDr9r<r3rErgrkr8r:r9r��reduce�or_r;r�r�r�r�r�r��FunctionType�
MethodTyper�r�r�r�r��
test.profileer�r�r�r�r�r�r�r+r;rHr]r`rerirmrrr�r�r�r�r�r�r�r�r�r�rr%r r0r2r;r>rQrRrbrCrer�r�r�)rMrs00r	�<module>r�s���(��
���
�������	��
�
�
�
�	�
�
�
�
�M�(�+�+�M�D0�0�,(2�,�h�.?�.?�(2�V�N�N�����Z�Z����[�[�(���[�[�(���Z�Z����V�V�V���X�X�x��
���W�W�g���[�[�(�����-�.��
�$�m�3��Y�Y�	���Z�Z���7��
�$�9�#�#�H�L�L�]�2S�]�'�2�q�2�]�2S�UV�W�Z[�Z`�Z`�`��	��	����
����	��
���
������"�"�E�$4�$4�5��+�-�+�>'�/��1B�1B�'�*�Z�Z����A�K�K����a�j�j�I�	��z�z�1�;�;�'��"�''�.��0A�0A�''�T	*�	*�	*�	*�&,�%7��9J�9J�&,�RC?�-�x�/@�/@�C?�Lz/�+�X�->�->�z/�x)I�$�h�&7�&7�)I�X1�1�$)�$�h�&7�&7�$)�N"�-�"�3�'�3�2�&�2�3�0�3�1�%�1�h;�k�h;�T	O�	O�9�9�B�B��n��
�^��
#�L�,��Q_�_��9(�[�9(�v
F�
F�"5�l�!B��s)�;�s)�j@V�1�8�3D�3D�@V�D��o�~�M��ET�(�(�*;�*;�ET�N�J�J��\��
,�,�)�.�8��!-�~�|�!K��&���FW�Yg�g��V)�k�V)�pT��T�nO�)�8�+<�+<�O�.Y��)�)�+=�Y�LD�(�(�*;�*;�LD��o/3Ts�P.

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