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

�

&Μg�=����dZddlmZddlZddlZddlmZmZddlZddlm	Z	ddlZddl
mZde_Gd�d	ej�ZGd
�de�ZGd�d
�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�Zedk(rej0d��yy)zTest run, coverage 54%.�)�runN)�captured_output�captured_stderr)�mock)�FuncTc�~�eZdZd�ZdedfdedfdedffZd�Ze	jjed	d
���d��Z
y
)�
ExceptionTestc	�J�Gd�dt�}|d�}|d�}	||�#|$r�	|�#|$ryt�5}tjj	t
d�5}d�|_tj�ddd�n#1swYnxYwddd�n#1swYnxYwYnwxYwYnwxYwj�j�j�}|jdt|��|jd|d	�|jd
|d�y)Nc��eZdZd�Zy)�JExceptionTest.test_print_exception_unhashable.<locals>.UnhashableExceptionc��y)NT�)�self�others  �7/usr/local/lib/python3.12/idlelib/idle_test/test_run.py�__eq__zQExceptionTest.test_print_exception_unhashable.<locals>.UnhashableException.__eq__s���N)�__name__�
__module__�__qualname__rrrr�UnhashableExceptionrs��
rr�ex1�ex2�cleanup_tracebackc��|S�Nr��t�es  r�<lambda>z?ExceptionTest.test_print_exception_unhashable.<locals>.<lambda> s��ar�zUnhashableException: ex2�zUnhashableException: ex1�
)�	Exceptionrr�patch�objectr�side_effect�print_exception�getvalue�strip�
splitlines�assertEqual�len�assertIn)rrrr�output�ct�tbs       r�test_print_exception_unhashablez-ExceptionTest.test_print_exception_unhashables���	�)�	�"�%�(��!�%�(��		.��3���"�	.�
.��	��&�
.�$�&�&����*�*�3�0C�D��)7����+�+�-�E�D�D��'�&�&��
.��	.���_�_�
�
$�
$�
&�
1�
1�
3������S��W�%��
�
�0�"�Q�%�8��
�
�0�"�R�&�9sY�$�B0�,�B*�%B� B	�=	B�B
�B�	B*�B$� B*�'B0�)B*�*B0�/B0�1/0zdivision by zero
�abczSname 'abc' is not defined. Did you mean: 'abs'? Or did you forget to import 'abc'?
zint.reelzAtype object 'int' has no attribute 'reel'. Did you mean: 'real'?
c	�j�|jD]8\}}}|j|��5	tt|dd��ddd��:y#|$rXt	j
�\}}}t
j|||�d}|j�d|��}|j||�Y�gwxYw#1swY��xYw)N)�code��evalrz: )
�data�subTestr8�compile�sys�exc_infor�get_message_linesrr,)	rr6�exc�msg�typ�valr1�actual�expects	         r�test_get_messagezExceptionTest.test_get_message1s���"�i�i�N�D�#�s����4��(�5����r�6�2�3�)�(�(���5�#&�<�<�>�L�C��b� �2�2�3��R�@��C�F� #���~�R��u�5�F��$�$�V�V�4�	5��)�(�s)�B)�A	�	AB&�#B)�%B&�&B)�)B2	rc��d�S)Nc��yrrrs  rr z(ExceptionTest.<lambda>.<locals>.<lambda>=s��$rrrrrr zExceptionTest.<lambda>=s��->r��new_callablec
�l�|j}|d|df|d|df|d|dff}d}|D]A\\}}}\}}	}
|j||f��5	tt|dd��ddd��C|j|t|��y#|$r�	tt|dd��nx#|	$rpt	�5}tj�ddd�n#1swYnxYwj�}|j||�|j|
|�|dz
}YnwxYwY��wxYw#1swY��xYw)Nr��)�codesr7r8)r9r:r8r;rrr(r)r.r,r-)
rr�d�data2�subtests�code1�exc1�msg1�code2�exc2�msg2r/rCs
             r�test_get_multiple_messagez'ExceptionTest.test_get_multiple_message<s5��
�I�I���A�$��!����!��a��d�|�a��d�A�a�D�\�:����8=�4��U�D�$�!4�%��t����U�5�M��2�&�����F�3�4�3�2�9>�	
����3�u�:�.���	&�&��W�U�B��7�8���&�,�.�&��/�/�1�/�.�.��!'���!2���
�
�d�F�3��
�
�d�F�3� �A�
��
&��	&��3�2�sg�D)�B�D&�B+�*D&�+D 	�:C�	D 	�C!�AD 	�D&�D 	� D&�#D)�%D&�&D)�)D3	N)rrrr2�ZeroDivisionError�	NameError�AttributeErrorr9rErr%r&rrWrrrr	r	su��:�.�%�';�<�
�I� F�
G���+�
,�	�D�	5�
�Z�Z���s�/�$?��A�/�A�/rr	c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�Sc�2�dt|�jzS)Nz%s:str��typer�rs r�__str__z	S.__str__Us���$�t�*�-�-�-�-rc�2�dt|�jzS)Nz
%s:unicoder^r`s r�__unicode__z
S.__unicode__Ws���d�4�j�1�1�1�1rc��y�Nr"rr`s r�__len__z	S.__len__Ys��rc��td�S)Nr4)�iterr`s r�__iter__z
S.__iter__[s���E�{�rc�2�dt|�jzS)Nz%s:itemr^�r�argss  r�__getitem__z
S.__getitem__]s���4��:�.�.�.�.rc�2�dt|�jzS)Nz%s:slicer^rks  r�__getslice__zS.__getslice___s���D��J�/�/�/�/rN)	rrrrarcrfrirmrorrrr\r\Ts ��.�2���/�0rr\c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�	MockShellc�$�|j�yr)�resetr`s r�__init__zMockShell.__init__ds���
�
�rc�:�|jj|�yr)�written�appendrks  r�writezMockShell.writefs�������D�!rc�6�|jj�Sr)�lines�popr`s r�readlinezMockShell.readlinehs���z�z�~�~��rc��yrrr`s r�closezMockShell.closejs��rc��g|_yr)rvr`s rrszMockShell.resetls	����rc�0�t|�ddd�|_y)N���)�listrz)rrzs  r�pushzMockShell.pushns���%�[��2��&��
rN)	rrrrtrxr|r~rsr�rrrrqrqcs ���"� �
��'rrqc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�StdInputFilesTestc��t�}tj|d�}|j|tj
�|j
|jd�|j
|jd�|j|j�|j
|jd�|j|j�|j|j��|j|j!��|j|j#��|j|j%��y)N�stdin�utf-8�strictz<stdin>)rqr�StdInputFile�assertIsInstance�io�
TextIOBaser,�encoding�errors�assertIsNone�newlines�name�assertFalse�closed�
assertTrue�isatty�readable�writable�seekable�r�shell�fs   r�	test_misczStdInputFilesTest.test_miscts���������U�G�,�����a����/�������W�-�������8�,����!�*�*�%��������+�������"�������
�#�����
�
��%��������&��������&rc��t�}tj|d�}|jt|j
�|jt|j�|jt|jd�|jt|jd�|jt|jdg�y)Nr�r�x)
rqrr��assertRaises�OSError�fileno�tell�seekrx�
writelinesr�s   r�test_unsupportedz"StdInputFilesTest.test_unsupported�s���������U�G�,�����'�1�8�8�,����'�1�6�6�*����'�1�6�6�1�-����'�1�7�7�C�0����'�1�<�<�#��7rc��t�}tj|d�}|jgd��|j	|j�d�|jgd��|j	|jd�d�|jgd��|j	|jd�d�|jgd��|j	|jd�d�|j	|jd�d	�|j	|jd
�d�|jdd
g�|j	|jd�d�|j
t|j
d�|j
t|j
d�|j
t|j
dd�y)Nr���one
�two
r7�one
two
r�)r�r��three
r7rL�onr"ze
tr#z	wo
three
r�r�rr7��?�1rK)rqrr�r�r,�readr��	TypeErrorr�s   r�	test_readzStdInputFilesTest.test_read�sJ��������U�G�,��
�
�
�)�*��������<�0�
�
�
�)�*���������\�2�
�
�
�)�*���������|�4�
�
�
�4�5���������D�)���������F�+���������]�3�
�
�
�G�W�%�&���������B�'����)�Q�V�V�S�1����)�Q�V�V�S�1����)�Q�V�V�Q��2rc���t�}tj|d�}|jgd��|j	|j�d�|j	|jd�d�|j	|jd�d�|jdg�|j	|j�d�|j	|j�d�|jgd��|j	|j�d	�|j	|j�d
�|jgd��|j	|jd�d
�|j	|jd�d�|j	|jd�d�|j	|jd�d�|jddg�|j	|jd�d�|j
t|jd�|j
t|jd�|j
t|jdd�y)Nr�)r�r�r�zfour
r�r�r�r�r�)�one�two�threer�r�)r�r�r�rLr�rKr�
r#rr7r�r�)	rqrr�r�r,r|r�r��	readlinesr�s   r�
test_readlinezStdInputFilesTest.test_readline�s���������U�G�,��
�
�
�:�;��������w�/�������B���1�������D�)�9�5�
�
�
�L�>�"��������w�/��������w�/�
�
�
�*�+��������u�-��������u�-�
�
�
�0�1�������A���-�������A���,�������A���-�������B���1�
�
�
�G�W�%�&�������A���+����)�Q�[�[�#�6����)�Q�[�[�#�6����)�Q�[�[�!�Q�7rc��t�}tj|d�}|jgd��|j	|j�ddg�|jgd��|j	|jd�ddg�|jgd��|j	|jd�ddg�|jgd��|j	|jd�ddg�|jgd��|j	|jd�dg�|jgd��|j	|jd�ddg�|jgd��|j
t|j
d	�|j
t|j
d
�|j
t|j
dd�y)Nr�r�r�r�r�rr"�r�r�rK)rqrr�r�r,r�r�r�r�s   r�test_readlinesz StdInputFilesTest.test_readlines�sd��������U�G�,��
�
�
�)�*���������'�(:�;�
�
�
�)�*�������R��7�G�*<�=�
�
�
�)�*�������T�*�W�g�,>�?�
�
�
�)�*�������Q��'�7�);�<�
�
�
�)�*�������Q��'��3�
�
�
�)�*�������Q��'�7�);�<�
�
�
�)�*����)�Q�[�[�#�6����)�Q�[�[�#�6����)�Q�[�[�!�Q�7rc��t�}tj|d�}|jgd��|j	|j
�|j
|j�d�|j�|j	|j
�|j
|j�d�|jt|jd�y)Nr�r�r�r�rK)rqrr�r�r�r�r,r|r~r�r�r�s   r�
test_closezStdInputFilesTest.test_close�s���������U�G�,��
�
�
�)�*�������"��������w�/�	���	�������"��������w�/����)�Q�W�W�a�0rN)	rrrr�r�r�r�r�r�rrrr�r�rs ��'�8�3�(8�28�*	1rr�c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�StdOutputFilesTestc��t�}tj|d�}|j|tj
�|j
|jd�|j
|jd�|j|j�|j
|jd�|j|j�|j|j��|j|j!��|j|j#��|j|j%��y)N�stdoutr�r�z<stdout>)rqr�
StdOutputFiler�r�r�r,r�r�r�r�r�r�r�r�r�r�r�r�r�s   rr�zStdOutputFilesTest.test_misc�s���������e�X�.�����a����/�������W�-�������8�,����!�*�*�%��������,�������"�������
�#��������&�����
�
��%��������&rc��t�}tj|d�}|jt|j
�|jt|j�|jt|jd�|jt|jd�|jt|jd�y)Nr�r)
rqrr�r�r�r�r�r�r�r|r�s   rr�z#StdOutputFilesTest.test_unsupported�s���������e�X�.�����'�1�8�8�,����'�1�6�6�*����'�1�6�6�1�-����'�1�6�6�1�-����'�1�:�:�q�1rc���t�}tj|d�}|jd�|j	|j
dg�|j
�|jd�|j	|j
dg�|j
�|jtd��|j	|j
dg�|j	t|j
dd�t�|j
�|jt|j�|j	|j
g�|jt|jd�|jt|jd�|j	|j
g�|jt|jdd	�|j	|j
g�y)
Nr��test�r�r��	tèś𝖙)r�r�r�test�{�spam�rqrr�rxr,rvrsr\r_�strr�r�r�s   r�
test_writezStdOutputFilesTest.test_write�s_��������e�X�.��	�����������);�(<�=�
���
�	���'�(�������)L�(M�N�
���
�	����)�*�+�������)L�(M�N�����e�m�m�A�.�q�1�2�C�8�
���
����)�Q�W�W�-��������+����)�Q�W�W�g�6����)�Q�W�W�c�2��������+����)�Q�W�W�f�f�=��������+rc�`�t�}tj|ddd�}|jd�|j	|j
dg�|j
�|jtd��|j	|j
dg�|j	t|j
dd�t�|j
�|jt|j�|j	|j
g�|jt|jd�|jt|jd�|j	|j
g�|jt|jd	d
�|j	|j
g�y)N�stderrziso-8859-15�backslashreplaceutèś𝖙¤)utè\u015b\U0001d599\xa4r�rr�r�r�r�r�r�s   r�test_write_stderr_nonencodablez1StdOutputFilesTest.test_write_stderr_nonencodable	s8��������e�X�}�>P�Q��	���+�,�������)S�(T�U�
���
�	����-�.�/�������)S�(T�U�����e�m�m�A�.�q�1�2�C�8�
���
����)�Q�W�W�-��������+����)�Q�W�W�g�6����)�Q�W�W�c�2��������+����)�Q�W�W�f�f�=��������+rc���t�}tj|d�}|jg�|j	|j
g�|j
�|jddg�|j	|j
ddg�|j
�|jddg�|j	|j
dd	g�|j
�|jtd
�g�|j	|j
dg�|j	t|j
dd�t�|j
�|jt|j�|j	|j
g�|jt|jd
�|j	|j
g�|jt|jdg�|jt|jd
g�|j	|j
g�|jt|jgg�|j	|j
g�y)Nr�r�r�)r�r�)r�r��onè
�twò)r�r�)r�r��tèst)r�r�rr�r�)rqrr�r�r,rvrsr\r_r�r�r�r�s   r�test_writelinesz"StdOutputFilesTest.test_writeliness���������e�X�.��	���R���������+�
���
�	���g�u�%�&�������-�/@�A�	C�
���
�	���j�(�+�,�������0�2F�G�	I�
���
�	���a�	�l�^�$�������)>�(?�@�����e�m�m�A�.�q�1�2�C�8�
���
����)�Q�\�\�2��������+����)�Q�\�\�3�7��������+����)�Q�\�\�G�9�=����)�Q�\�\�C�5�9��������+����)�Q�\�\�2�r�:��������+rc���t�}tj|d�}|j|j�|jd�|j
�|j|j�|jt|j
d�|j|jdg�|j
�|jt|jd�y)Nr�r�r�r�rK)
rqrr�r�r�rxr~r�r��
ValueErrorr,rvr�r�s   rr�zStdOutputFilesTest.test_close;s���������e�X�.��������"�	�����	���	�������!����*�a�g�g�s�3�������);�(<�=�	���	����)�Q�W�W�a�0rN)	rrrr�r�r�r�r�r�rrrr�r��s ��'�2�,�.,�(,�<
1rr�c�$�eZdZd�Zd�Zd�Zd�Zy)�RecursionLimitTestc��tj�|jtj�tj
}|j
t|d��|j
t|dd�|j
t|d�y)N�d)�limiti�r)	r�install_recursionlimit_wrappers�
addCleanup�!uninstall_recursionlimit_wrappersr<�setrecursionlimitr�r�r�)rr�s  r� test_bad_setrecursionlimit_callsz3RecursionLimitTest.test_bad_setrecursionlimit_callsKsf���+�+�-�����=�=�>��!�!�����)�Q�c��2����)�Q��T�2����*�a��+rc�T�tj�|jtj�t	j
�}|jtj|�t	j|dz�t	j
�}|j||dz�yre)rr�r�r�r<�getrecursionlimitr�r,�r�
orig_reclimit�new_reclimits   r�test_roundtripz!RecursionLimitTest.test_roundtripSs|���+�+�-�����=�=�>��-�-�/�
�����-�-�}�=����m�a�/�0��,�,�.������}�q�'8�9rc���tj�}tj�|j	tj
�tj�}|j
||�yr)r<r�rr�r�r�r,r�s   r�&test_default_recursion_limit_preservedz9RecursionLimitTest.test_default_recursion_limit_preserved`sL���-�-�/�
��+�+�-�����=�=�>��,�,�.������}�5rc���d�}tj|d�|j|jd�d|_tj|d�|j|jd�y)Nc��y)�	docstringNrrrr�funcz,RecursionLimitTest.test_fixdoc.<locals>.funcis�r�morezdocstring

more)r�fixdocr,�__doc__)rr�s  r�test_fixdoczRecursionLimitTest.test_fixdocgsQ����
�
�4�� �������':�;�����
�
�4�� �������v�.rN)rrrr�r�r�r�rrrr�r�Hs��,�:�6�/rr�c��eZdZd�Zy)�HandleErrorTestc��|j}td�5}tjdt��5}	t
�#t
$r$tjjddd�YnwxYw|tjd�dt_	||j�d�	t�#t$r$tjjddd�YnwxYw|tjd�dt_|j�}|jd|�|jd|�|jd	|�||jd
�ddd�n#1swYnxYwddd�y#1swYyxYw)N�
__stderr__z!idlelib.run.thread.interrupt_mainrHr4�123TFr7�
IndexErrorrL)r,rrr%r�EOFErrorr�MyRPCServer�handle_error�exit_nowr)r��quittingr.�called)r�eq�errr�r@s     r�test_fatal_errorz HandleErrorTest.test_fatal_errorss*��
�
�
��
�\�
*�c�
�Z�Z�;�%)�+�.2�
A�����
A����,�,�T�5�%�@�
A���s�|�|�T�"� �C�L��s�|�|�~�r�"�
A� � ���
A����,�,�T�5�%�@�
A���s�|�|�T�"� �C�L��,�,�.�C��M�M�%��%��M�M�%��%��M�M�,��,��t�{�{�A��)+�+�+��+�
*�
*�s\�E5�E �<�*A)�&E �(A)�)<E �&B,�,*C�E �C�A>E �	E5� E)	�%E5�5E>N)rrrrrrrr�r�qs��rr�c�2�eZdZed��Zed��Zd�Zy)�ExecRuncodeTestc�2�|jttdtj�t	�|_|j
t_t
j�}t	d��|j_	tj|�|_y)Nr(F)�result)�addClassCleanup�setattrrr(r�prtr�Mock�console�getvar�	Executive�ex)�cls�mockrpcs  r�
setUpClasszExecRuncodeTest.setUpClass�s^�����G�C�(9�#�:M�:M�N��&���!�g�g����)�)�+��!%�U�!3��������w�'��rc�J�tjtjk(sJ�yr)r<�
excepthook�__excepthook__)rs r�
tearDownClasszExecRuncodeTest.tearDownClass�s���~�~��!3�!3�3�3�3rc�D�|j}|jd�|j|jdt�|jttdtj�d�t_	|jd�|j|jjdt�d�t_	|jd�|j\}}}|j|t�|jt|jt��y)Nr3rrc�,�tj|�Sr)rr()rrr1s   rr z1ExecRuncodeTest.test_exceptions.<locals>.<lambda>�s��#�*=�*=�a�*@rc��yrrrrrr z1ExecRuncodeTest.test_exceptions.<locals>.<lambda>�s��r)r�runcode�assertIs�
user_exc_inforXr�rr<rrr	rlr�r��
isinstance�__context__)rrrrr1s     r�test_exceptionszExecRuncodeTest.test_exceptions�s���
�W�W��
�
�
�5���
�
�b�&�&�q�)�+<�=������l�C�4F�4F�G�@���
�
�
�5���
�
�d�h�h�m�m�A�&�(9�:�%���
�
�
�5���#�#���1�b��
�
�a��#����
�1�=�=�2C�D�ErN)rrr�classmethodrrrrrrrr�s.���(��(��4��4�Frr�__main__rL)�	verbosity)r��idlelibrr�r<�test.supportrr�unittestr�idlelib.idle_test.mock_idler�testing�TestCaser	r�r\rqr�r�r�r�rr�mainrrr�<module>r)s�����	�
�9����,����A/�H�%�%�A/�J0��0�'�'�d1��)�)�d1�Nl1��*�*�l1�^&/��*�*�&/�R�h�'�'��8F�h�'�'�F�@�z���H�M�M�A��r

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