Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/idle_test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/idle_test/__pycache__/test_debugger.cpython-312.opt-1.pyc

�

&Μg�%���dZddlmZddlmZddlmZddlmZddl	m
Z
ddlZddlmZdd	l
mZmZ	ed
�ZGd�d�ZGd
�dej$�ZGd�dej$�ZGd�dej$�ZGd�dej$�ZGd�dej$�ZGd�dej$�Zedk(rej4d��yy)zeTest debugger, coverage 66%

Try to make tests pass with draft bdbx, which may replace bdb in 3.13+.
�)�debugger)�
namedtuple)�dedent)�Tk)�requiresN)�mock)�Mock�patchz9
    i = 1
    i += 2
    if i == 3:
       print(i)
    c��eZdZdZd�Zy)�	MockFramezMinimal mock frame.c� �||_||_y�N)�f_code�f_lineno)�self�code�linenos   �</usr/local/lib/python3.12/idlelib/idle_test/test_debugger.py�__init__zMockFrame.__init__s�������
�N)�__name__�
__module__�__qualname__�__doc__r�rrrrs
���rrc�.�eZdZed��Zd�Zd�Zd�Zy)�IdbTestc��t�|_tj|j�|_ttdd��}t|d�}d|_t|d�}||_||_	d|_
y)Nzidlelib/file.py�exec��mode��zfile.py:2: <module>())r	�guir�Idb�idb�compile�	TEST_CODEr�f_back�frame�msg)�cls�code_obj�frame1�frame2s    r�
setUpClasszIdbTest.setUpClass#sd���&����,�,�s�w�w�'����9�&7�f�E���8�Q�'����
��8�Q�'����
���	�)��rc�d�|j|jj|j�yr)�assertIsr&r$�rs r�	test_initzIdbTest.test_init1s���
�
�d�h�h�l�l�D�H�H�-rc���t�|j_|jj	|j
�|jjj
|j|j
�yr)r	r$�interactionr&�	user_liner*�assert_called_once_withr+r3s r�test_user_linezIdbTest.test_user_line5sH��#�v����������4�:�:�&������4�4�T�X�X�t�z�z�Jrc�,�tt�t�df}t�|j_|j
j
|j|�|jjj|j|j|�yr)
�type�
ValueErrorr	r$r6r&�user_exceptionr*r8r+)r�exc_infos  r�test_user_exceptionzIdbTest.test_user_exception;sb����$�j�l�D�9��#�v�����������
�
�H�5������4�4����$�*�*�h�	0rN)rrr�classmethodr0r4r9r?rrrrr!s$���*��*�.�K�0rrc��eZdZd�Zy)�FunctionTestc�h�ttdd��}t|d�}||_|j	tj|��|jtj|�d�ttdd��}t|d�}d|_|jtj|��|jtj|�d�||_|jtj|��||_|j	tj|��y)	Nzrpc.pyrr r#zrpc.py:2: <module>()zidlelib/debugger.pyr"zdebugger.py:1: <module>())
r'r(rr)�
assertTruer�_in_rpc_code�assertEqual�_frame2message�assertFalse)r�rpc_obj�	rpc_framer-�
code_frames     r�test_functionszFunctionTest.test_functionsGs����)�H�6�:���g�q�)�	�$�	������-�-�i�8�9�����0�0��;�/�	1��9�&;�&�I���x��+�
� �
������.�.�z�:�;�����0�0��<�4�	6�'�
������.�.�z�:�;�%�
������-�-�j�9�:rN)rrrrLrrrrBrBDs��;rrBc�V�eZdZdZed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)
�DebuggerTestz0Tests for Debugger that do not need a real root.c�t�t�|_t�|j_t�|_t	j
tjd�5t
j|j|j�|_ddd�t�|j_y#1swY�#xYw)N�make_gui)r	�pyshell�rootr&r
�objectr�Debugger�r,s rr0zDebuggerTest.setUpClass_sn���f����6������&���
�\�\�(�+�+�Z�
8�#�,�,�S�[�[�#�'�'�B�C�L�9� �F�����9�
8�s�0B.�.B7c��|jj�|jjj	�yr)r�contr&�set_continue�assert_called_oncer3s r�	test_contzDebuggerTest.test_conths(���
�
���������0�0�2rc��|jj�|jjj	�yr)r�stepr&�set_steprYr3s r�	test_stepzDebuggerTest.test_stepl�(���
�
���������,�,�.rc��|jj�|jjj	�yr)r�quitr&�set_quitrYr3s r�	test_quitzDebuggerTest.test_quitpr_rc���tj|jd�5}|jj�|jj
j
|�ddd�y#1swYyxYw�Nr*)r
rSr�nextr&�set_nextr8�rr*s  r�	test_nextzDebuggerTest.test_nexttsJ��
�\�\�$�-�-��
1�U��M�M��� ��H�H���5�5�e�<�2�
1�
1���AA*�*A3c���tj|jd�5}|jj�|jj
j
|�ddd�y#1swYyxYwre)r
rSr�retr&�
set_returnr8rhs  r�test_retzDebuggerTest.test_retysJ��
�\�\�$�-�-��
1�U��M�M�����H�H���7�7��>�2�
1�
1�rjc��|jjdd�|jjj	dd�y)N�test.py�)r�clear_breakpointr&�clear_breakr8r3s r�test_clear_breakpointz"DebuggerTest.test_clear_breakpoint~s0���
�
�&�&�y�!�4������4�4�Y��Brc��|jjd�|jjj	d�y)Nrp)r�clear_file_breaksr&�clear_all_file_breaksr8r3s r�test_clear_file_breaksz#DebuggerTest.test_clear_file_breaks�s,���
�
�'�'�	�2����&�&�>�>�y�Irc����tdd��G�fd�dt�}t�|j_|dddg�|dgd��f|jj_|jjd	d
�|jjjd	d
�|jj�|jjjtjd	d
�tjdd�tjdd�tjdd�tjdd�tjdd
�g�y)N�FileIO�filenamec���eZdZ�fd�Zy)�>DebuggerTest.test_set_load_breakpoints.<locals>.MockEditWindowc�.���|�|_||_yr)�io�breakpoints)r�fnr�rzs   �rrzGDebuggerTest.test_set_load_breakpoints.<locals>.MockEditWindow.__init__�s��� ��*���#.�� rN)rrrr)rzs�r�MockEditWindowr}�s���
/rr�ztest1.pyrqztest2.py)�
�,�-ztest0.pyr"r�r�r�)rrSr	rQ�flist�inversedictr�set_breakpointr&�	set_breakr8�load_breakpoints�assert_has_callsr�call)rr�rzs  @r�test_set_load_breakpointsz&DebuggerTest.test_set_load_breakpoints�s����H�j�1��	/�V�	/�
"�V������:��1�v�.��:�|�4�*
������&�	
�
�
�$�$�Z��3������2�2�:�q�A��
�
�&�&�(������+�+�
�Y�Y�z�1�
%�
�Y�Y�z�1�
%�
�Y�Y�z�1�
%�
�Y�Y�z�2�
&�
�Y�Y�z�2�
&�
�Y�Y�z�2�
&�
(�	)rc�j�ttdd�}t|d�}||j_t�|j_tdd��5|jj�ddd�|jjjjdd�y#1swY�:xYw)Nztest_sync.pyrr"zidlelib.debugger.os.path.existsT��return_value)r'r(rrr*r	r�r
�sync_source_line�gotofileliner8)r�	test_code�
test_frames   r�test_sync_source_linez"DebuggerTest.test_sync_source_line�s����I�~�v�>�	��y�!�,�
�(��
�
��"�f��
�
��
�4�4�
H��M�M�*�*�,�I��
�
���(�(�@�@��QR�S�I�
H�s�B)�)B2N)rrrrr@r0rZr^rcrirnrtrxr�r�rrrrNrN\sG��6��#��#�3�/�/�=�
?�
C�J�)�2	TrrNc�N�eZdZdZed��Zed��Zd�Zd�Zd�Z	d�Z
d�Zy	)
�DebuggerGuiTestzbTests for debugger.Debugger that need tk root.

    close needs debugger.top set in make_gui.
    c��td�t�x|_}|j�t	�|_||j
_t	�|_y�Nr$)rrrR�withdrawr	rQr&)r,rRs  rr0zDebuggerGuiTest.setUpClass�s>������$����4��
�
���f���������&��rc�<�|jj�|`yr�rR�destroyrUs r�
tearDownClasszDebuggerGuiTest.tearDownClass�����������Hrc��tj|j|j�|_|j|j_yr)rrTrQr&rRr3s r�setUpzDebuggerGuiTest.setUp�s.�� �)�)�$�,�,����A��
�!�Y�Y��
�
�rc���|jjdd�|jjjdd�|j	|jj
d�y)Nr"�twor)r�runr&r8rF�interactingr3s r�test_run_debuggerz!DebuggerGuiTest.test_run_debugger�sH���
�
���!�U�#������,�,�Q��6�������2�2�A�6rc��|jj�|jjj	�yr)r�closerQ�close_debuggerrYr3s r�
test_closezDebuggerGuiTest.test_close�s(���
�
�������#�#�6�6�8rc��|jj�|j|jjj|j�yr)r�
show_stackrF�stackviewerr$r3s r�test_show_stackzDebuggerGuiTest.test_show_stack�s6���
�
� � �"�������2�2�6�6��
�
�Frc��tdd�}||j_d|j_gdf|jj
_|jj�|j|jjj|j�|jj
j|d�y)Nr)rrr*r�r&�	get_stackr�r�rFr$r8)rr�s  r�test_show_stack_with_framez*DebuggerGuiTest.test_show_stack_with_frame�s����t�T�*�
�(��
�
��%)��
�
�!�+-�q�'������'��
�
� � �"�	
������2�2�6�6��
�
�F������2�2�:�t�DrN)rrrrr@r0r�r�r�r�r�r�rrrr�r��sJ���
��������'�7�
9�
G�Err�c�D�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	y)�StackViewerTestc�l�td�t�|_|jj�yr��rrrRr�rUs rr0zStackViewerTest.setUpClass��"������4��������rc�<�|jj�|`yrr�rUs rr�zStackViewerTest.tearDownClass�r�rc�0�ttdd�|_t|jd�dft|jd�dfg|_tj|jdd�|_|jj|j�y)N�test_stackviewer.pyrr"r#)
r'r(rr�stackr�StackViewerrR�sv�
load_stackr3s rr�zStackViewerTest.setUp�st���I�'<�f�E��	�
�t�y�y�!�
$�a�(�
�t�y�y�!�
$�a�(�
��
�
�&�&�t�y�y�$��=��������4�:�:�&rc��d}d}|j}tj|||�}|jt	|d��y)Nr�)rRrr�rD�hasattr)rr$r��
master_windowr�s     rr4zStackViewerTest.test_init�s<�������	�	�
�
�
!�
!�-���
<�������G�,�-rc��|j|jj|j�|jd|jj	d�v�|j|jj	d�d�y)Nz?.<module>(), line 1:rr"z?.<module>(), line 2: )rFr�r�rD�getr3s r�test_load_stackzStackViewerTest.test_load_stacks[��	
���������
�
�3����/�4�7�7�;�;�q�>�A�B���������Q��)A�Brc�0�t�|j_tdd��5}|jj	d�|jd�|jjjjd�ddd�y#1swYyxYw)Nzidlelib.debugger.os.path.isfileTr�r"r�)r	r�r�r
�show_sourcer8�open)r�isfiles  r�test_show_sourcez StackViewerTest.test_show_sourcesi�������
�
�4�4�
H�F��G�G����"��*�*�+@�A��G�G�M�M���6�6�7L�M�I�
H�
H�s�AB�BN)
rrrr@r0r�r�r4r�r�rrrr�r��s>������
����'�.�C�Nrr�c�2�eZdZed��Zed��Zd�Zy)�
NameSpaceTestc�l�td�t�|_|jj�yr�r�rUs rr0zNameSpaceTest.setUpClassr�rc�<�|jj�|`yrr�rUs rr�zNameSpaceTest.tearDownClassr�rc�D�tj|jd�y)N�Test)r�NamespaceViewerrRr3s rr4zNameSpaceTest.test_init$s��� � ����F�3rN)rrrr@r0r�r4rrrr�r�s-������
����4rr��__main__r#)�	verbosity)r�idlelibr�collectionsr�textwrapr�tkinterr�test.supportr�unittestr�
unittest.mockr	r
r(r�TestCaserrBrNr�r�r�r�mainrrr�<module>r�s����
�"���!���%�/���
	�	��� 0�h��� 0�F;�8�$�$�;�0LT�8�$�$�LT�^8E�h�'�'�8E�v.N�h�'�'�.N�b4�H�%�%�4�"�z���H�M�M�A��r

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