Your IP : 216.73.216.196


Current Path : /opt/alt/python312/lib64/python3.12/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/idlelib/idle_test/__pycache__/test_query.cpython-312.opt-2.pyc

�

�#�j�<���	ddlmZddlZddlmZddlmZddlmZm	Z	ddl
Z
ddlmZddlm
Z
Gd�d	ej�ZGd
�dej�ZGd�d
eje�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�dej�ZGd�deje�ZGd �d!ej�ZGd"�d#ej�ZGd$�d%ej�Zed&k(rej>d'd(�)�yy)*�)�queryN��requires)�ExtraAssertions)�Tk�END)�mock)�Varc�@�eZdZ	Gd�d�Zd�Zd�Zd�Zd�Zd�Zy)	�	QueryTestc��eZdZejj
ZejjZejjZd�Zd�Z	d�Z
y)�QueryTest.Dummy_Queryc�T�t|��|_ddi|_d|_d|_y)N��value�text�F)r
�entry�entry_error�result�	destroyed��self�dummy_entrys  �C/opt/alt/python312/lib64/python3.12/idlelib/idle_test/test_query.py�__init__zQueryTest.Dummy_Query.__init__"s(���;�/�D�J� &��|�D���D�K�"�D�N�c�"�||jd<y�Nr�r�r�messages  r�	showerrorzQueryTest.Dummy_Query.showerror'���'.�D���V�$rc��d|_y�NT)r�rs r�destroyzQueryTest.Dummy_Query.destroy)s	��!�D�NrN)�__name__�
__module__�__qualname__r�Query�entry_ok�ok�cancelrr#r(�rr�Dummy_Queryrs<���;�;�'�'��
�[�[�^�^�����#�#��	#�
	/�	"rr1c���|jd�}|j|j�d�|j|j|jfd�|jd|jd�y)N� �NFz
blank liner)r1�assertEqualr-rr�assertInr�r�dialogs  r�test_entry_ok_blankzQueryTest.test_entry_ok_blank,sa���!�!�#�&��������*�D�1����&�-�-��)9�)9�:�M�J��
�
�l�F�$6�$6�v�$>�?rc���|jd�}|j}||j�d�||j|jfd�||j
dd�y)N�  good �goodr4rr)r1r5r-rrr)rr8�Equals   r�test_entry_ok_goodzQueryTest.test_entry_ok_good2s\���!�!�)�,��� � ��
�f�o�o���(�
�v�}�}�f�.�.�/��?�
�f� � ��(�"�-rc�r�|jd�}tj�|j_|j|j
�d�|j|jjj�|j`|j|j|jfd�y)Nrr4)r1r	�Mockr�	focus_setr5r.�
assertTrue�calledrrr7s  r�
test_ok_blankzQueryTest.test_ok_blank9s���!�!�"�%��!%���������������d�+�������.�.�5�5�6��L�L�"����&�-�-��)9�)9�:�M�Jrc��|jd�}|j|j�d�|j|j|jfd�y)Nr<)r<T)r1r5r.rrr7s  r�test_ok_goodzQueryTest.test_ok_goodAsG���!�!�&�)���������d�+����&�-�-��)9�)9�:�N�Krc��|jd�}|j|j�d�|j|j|jfd�y)Nzdoes not matterr&)r1r5r/rrr7s  r�test_cancelzQueryTest.test_cancelFsH���!�!�"3�4���������$�/����&�-�-��)9�)9�:�L�IrN)	r)r*r+r1r9r>rDrFrHr0rrrrs,���"�"� @�.�K�L�
Jrrc�:�eZdZ	Gd�d�Zd�Zd�Zd�Zd�Zy)�SectionNameTestc�J�eZdZejj
ZdgZd�Zd�Zy)�!SectionNameTest.Dummy_SectionName�usedc�8�t|��|_ddi|_y�Nrrr�r
rrrs  rrz*SectionNameTest.Dummy_SectionName.__init__R����;�/�D�J� &��|�D�rc�"�||jd<yrr r!s  rr#z+SectionNameTest.Dummy_SectionName.showerrorUr$rN)	r)r*r+r�SectionNamer-�
used_namesrr#r0rr�Dummy_SectionNamerLOs$���$�$�-�-���X�
�	,�	/rrUc��|jd�}|j|j�d�|jd|jd�y�Nr3zno namer�rUr5r-r6rr7s  r�test_blank_section_namez'SectionNameTest.test_blank_section_nameXsB���'�'��,��������*�D�1��
�
�i��!3�!3�F�!;�<rc��|jd�}|j|j�d�|jd|jd�y)NrM�userrXr7s  r�test_used_section_namez&SectionNameTest.test_used_section_name]sB���'�'��/��������*�D�1��
�
�e�V�/�/��7�8rc��|jd�}|j|j�d�|jd|jd�y)N� goodgoodgoodgoodgoodgoodgoodgoodzlonger than 30rrXr7s  r�test_long_section_namez&SectionNameTest.test_long_section_namebsC���'�'��1��������*�D�1��
�
�&��(:�(:�6�(B�Crc��|jd�}|j|j�d�|j|jdd�y)Nr;r<rr)rUr5r-rr7s  r�test_good_section_namez&SectionNameTest.test_good_section_namegsD���'�'�	�2��������*�F�3�����+�+�F�3�R�8rN)r)r*r+rUrYr\r_rar0rrrJrJLs$��)�/�/�=�
9�
D�
9rrJc�:�eZdZ	Gd�d�Zd�Zd�Zd�Zd�Zy)�ModuleNameTestc�H�eZdZejj
ZdZd�Zd�Zy)�ModuleNameTest.Dummy_ModuleNamerc�8�t|��|_ddi|_yrOrPrs  rrz(ModuleNameTest.Dummy_ModuleName.__init__srQrc�"�||jd<yrr r!s  rr#z)ModuleNameTest.Dummy_ModuleName.showerrorvr$rN)	r)r*r+r�
ModuleNamer-�text0rr#r0rr�Dummy_ModuleNamereps"���#�#�,�,����	,�	/rrjc��|jd�}|j|j�d�|jd|jd�yrW�rjr5r-r6rr7s  r�test_blank_module_namez%ModuleNameTest.test_blank_module_nameysB���&�&�s�+��������*�D�1��
�
�i��!3�!3�F�!;�<rc��|jd�}|j|j�d�|jd|jd�y)N� __name_xyz123_should_not_exist__z	not foundrrlr7s  r�test_bogus_module_namez%ModuleNameTest.test_bogus_module_name~sC���&�&�'I�J��������*�D�1��
�
�k�6�#5�#5�f�#=�>rc��|jd�}|j|j�d�|jd|jd�y)N�	itertoolszsource-basedrrlr7s  r�test_c_source_namez!ModuleNameTest.test_c_source_name�sB���&�&�{�3��������*�D�1��
�
�n�f�&8�&8��&@�Arc�D�|jd�}|j|j�d�|j|jdd�|jd�}|j|j�d�|j|jdd�y)N�idlelib�__init__.pyrrzidlelib.idlezidle.py)rj�assertEndsWithr-r5rr7s  r�test_good_module_namez$ModuleNameTest.test_good_module_name�s����&�&�y�1�����F�O�O�-�}�=�����+�+�F�3�R�8��&�&�~�6�����F�O�O�-�y�9�����+�+�F�3�R�8rN)r)r*r+rjrmrprsrxr0rrrcrcms$��(�/�/�=�
?�
B�
9rrcc�4�eZdZ	Gd�d�Zd�Zd�Zd�Zy)�GotoTestc�D�eZdZejj
Zd�Zd�Zy)�GotoTest.Dummy_ModuleNamec�8�t|��|_ddi|_yrOrPrs  rrz"GotoTest.Dummy_ModuleName.__init__�rQrc�"�||jd<yrr r!s  rr#z#GotoTest.Dummy_ModuleName.showerror�r$rN)r)r*r+r�Gotor-rr#r0rrrjr|�s���:�:�&�&��	,�	/rrjc��|jd�}|j|j�d�|jd|jd�y)N�aznot a base 10 integerrrlr7s  r�test_bogus_gotozGotoTest.test_bogus_goto�sC���&�&�s�+��������*�D�1��
�
�-�v�/A�/A�&�/I�Jrc��|jd�}|j|j�d�|jd|jd�y)N�0znot a positive integerrrlr7s  r�
test_bad_gotozGotoTest.test_bad_goto�sC���&�&�s�+��������*�D�1��
�
�.��0B�0B�6�0J�Krc��|jd�}|j|j�d�|j|jdd�y)N�1�rr)rjr5r-rr7s  r�test_good_gotozGotoTest.test_good_goto�sD���&�&�s�+��������*�A�.�����+�+�F�3�R�8rN)r)r*r+rjr�r�r�r0rrrzrz�s ��"�/�/�K�
L�
9rrzc�(�eZdZ	Gd�d�Zd�Zy)�HelpsourceBrowsefileTestc�F�eZdZejj
Ze�Zy)�)HelpsourceBrowsefileTest.Dummy_HelpSourceN)r)r*r+r�
HelpSource�browse_filer
�pathvarr0rr�Dummy_HelpSourcer��s���&�&�2�2���%�rr�c�t�|j�}dd�dfdd�tfdd�dfdd�tffD]{\}}}|j�5|jj	|�||_|j
�|j|jj�|�ddd��}y#1swY��xYw)Nrc��y�Nrr0�r��b�cs   r�<lambda>zBHelpsourceBrowsefileTest.test_file_replaces_path.<locals>.<lambda>�s��"rc��tS�N��__file__r�s   rr�zBHelpsourceBrowsefileTest.test_file_replaces_path.<locals>.<lambda>�s��8r�htestc��yr�r0r�s   rr�zBHelpsourceBrowsefileTest.test_file_replaces_path.<locals>.<lambda>�s��rrc��tSr�r�r�s   rr�zBHelpsourceBrowsefileTest.test_file_replaces_path.<locals>.<lambda>�s��r)	r�r��subTestr��set�askfilenamer�r5�get)rr8�path�funcrs     r�test_file_replaces_pathz0HelpsourceBrowsefileTest.test_file_replaces_path�s����&�&�(���_�b�)��+�X�6��/�7�3��0�(�;�	#=��D�$��
�������"�"�4�(�%)��"��"�"�$�� � ����!3�!3�!5�v�>�	 ��#=�
 ��s
�AB.�.B7	N)r)r*r+r�r�r0rrr�r��s��>���?rr�c�b�eZdZ	Gd�d�Zej
Zed��Zd�Z	d�Z
d�Zd�Zy)	�HelpsourcePathokTestc�F�eZdZejj
Zd�Zdd�Zy)�%HelpsourcePathokTest.Dummy_HelpSourcec�8�t|��|_ddi|_yrO)r
r��
path_error)r�
dummy_paths  rrz.HelpsourcePathokTest.Dummy_HelpSource.__init__�s���*�-�D�I�%�r�l�D�OrNc�"�||jd<yr)r�)rr"�widgets   rr#z/HelpsourcePathokTest.Dummy_HelpSource.showerror�s��&-�D�O�O�F�#rr�)r)r*r+rr��path_okrr#r0rrr�r��s���"�"�*�*��	+�	.rr�c�.�|jt_yr�)�
orig_platformr�platform��clss r�
tearDownClassz"HelpsourcePathokTest.tearDownClass�s���*�*��rc��|jd�}|j|j�d�|jd|jd�y)Nr3zno help filer)r�r5r�r6r�r7s  r�test_path_ok_blankz'HelpsourcePathokTest.test_path_ok_blank�sB���&�&�s�+��������)�4�0��
�
�n�f�&7�&7��&?�@rc��|jtdz�}|j|j�d�|j	d|j
d�y)Nzbad-bad-badz	not existr)r�r�r5r�r6r�r7s  r�test_path_ok_badz%HelpsourcePathokTest.test_path_ok_bad�sG���&�&�x�-�'?�@��������)�4�0��
�
�k�6�#4�#4�V�#<�=rc�J�|jd�}|j}dD]u}|j�5|jj	|�|j|j�|�|j|jdd�ddd��wy#1swY��xYw)Nr)z
www.py.orgz
http://py.orgr)r�r5r�r�r�r�r�)rr8r=�urls    r�test_path_ok_webz%HelpsourcePathokTest.test_path_ok_web�s���&�&�r�*��� � ��0�C�����������$�� � ����!1�3�7�� � ��!2�!2�6�!:�B�?� ��1���s�AB�B"	c�d�|jd�}dD]�\}}|j�5|t_|jjt�|j|j�|tz�|j|jdd�ddd���y#1swY��xYw)Nr))�darwin�file://)�otherrr)
r�r�rr�r�r�r�r5r�r�)rr8r��prefixs    r�test_path_ok_filez&HelpsourcePathokTest.test_path_ok_file�s����&�&�r�*�� D��H�f�����!)���������)�� � ����!1�6�H�3D�E�� � ��!2�!2�6�!:�B�?�	 ��!E���s�A1B&�&B/	N)
r)r*r+r�rr�r��classmethodr�r�r�r�r�r0rrr�r��sC��:�.�.��N�N�M��+��+�A�
>�
@�@rr�c�(�eZdZ	Gd�d�Zd�Zy)�HelpsourceEntryokTestc�L�eZdZejj
ZiZiZd�Zd�Z	y)�&HelpsourceEntryokTest.Dummy_HelpSourcec��|jSr�)�namer's r�item_okz.HelpsourceEntryokTest.Dummy_HelpSource.item_ok�����9�9�rc��|jSr�)r�r's rr�z.HelpsourceEntryokTest.Dummy_HelpSource.path_ok�r�rN)
r)r*r+rr�r-rr�r�r�r0rrr�r��s'���#�#�,�,�����
�	�	rr�c���|j�}dD]N\}}}|j�5||c|_|_|j	|j�|�ddd��Py#1swY�[xYw)N))NNN)N�doc.txtN)�docNN)r�r�)r�r�)r�r�r�r�r5r-)rr8r�r�rs     r�test_entry_ok_helpsourcez.HelpsourceEntryokTest.test_entry_ok_helpsourcesf���&�&�(��#K��D�$������+/��(���V�[�� � ����!2�F�;� ��	#K� ��s�0A%�%A.	N)r)r*r+r�r�r0rrr�r��s��;���<rr�c�4�eZdZ	Gd�d�Zd�Zd�Zd�Zy)�CustomRunCLIargsokTestc�D�eZdZejj
Zd�Zd�Zy)�&CustomRunCLIargsokTest.Dummy_CustomRunc�8�t|��|_ddi|_yrOrPrs  rrz/CustomRunCLIargsokTest.Dummy_CustomRun.__init__rQrc�"�||jd<yrr r!s  rr#z0CustomRunCLIargsokTest.Dummy_CustomRun.showerrorr$rN)r)r*r+r�	CustomRun�cli_args_okrr#r0rr�Dummy_CustomRunr�s���o�o�1�1��	,�	/rr�c�f�|jd�}|j|j�g�y)Nr3)r�r5r�r7s  r�test_blank_argsz&CustomRunCLIargsokTest.test_blank_argss+���%�%�c�*������+�+�-�r�2rc��|jd�}|j|j�d�|jd|jd�y)Nz'no-closing-quotez
No closingr)r�r5r�r6rr7s  r�test_invalid_argsz(CustomRunCLIargsokTest.test_invalid_argssE���%�%�&9�:������+�+�-�t�4��
�
�l�F�$6�$6�v�$>�?rc���gd�}|jdj|�dz�}|j|j�|dgz�|j|jdd�y)N)z-n�10z	--verbosez-pz/pathz--namer3z
 "my name"zmy namerr)r��joinr5r�r)r�argsr8s   r�test_good_argsz%CustomRunCLIargsokTest.test_good_args!s_��A���%�%�c�h�h�t�n�|�&C�D������+�+�-�t�y�k�/A�B�����+�+�F�3�R�8rN)r)r*r+r�r�r�r�r0rrr�r�
s��<�/�/�3�@�
9rr�c�(�eZdZ	Gd�d�Zd�Zy)�CustomRunEntryokTestc�P�eZdZejj
ZiZe�Zd�Z	y)�$CustomRunEntryokTest.Dummy_CustomRunc��|jSr�)�cli_argsr's rr�z0CustomRunEntryokTest.Dummy_CustomRun.cli_args_ok/s���=�=� rN)
r)r*r+rr�r-rr
�
restartvarr�r0rrr�r�+s"���?�?�+�+�����U�
�	!rr�c�*�|j�}dD]r}|jj|�ddgdg|fffD]H\}}|j||��5||_|j|j
�|�ddd��J�ty#1swY�WxYw)N>FT)NNzmy arg)�restartr�)r�r�r�r�r�r5r-)rr8r�r�rs     r�test_entry_ok_customrunz,CustomRunEntryokTest.test_entry_ok_customrun2s����%�%�'��$�G����!�!�'�*�%1�'/�j�H�:�w�2G�%H�%J� ��&��\�\�'�H�\�E�&.�F�O��$�$�V�_�_�%6��?�F�E�%J�%�F�E�s�(B	�	BN)r)r*r+r�r�r0rrr�r�(s��>�!�!�@rr�c�D�eZdZed��Zed��Zd�Zd�Zd�Zd�Z	y)�QueryGuiTestc���td�t�x|_}|jj�t	j
|ddd��|_tj�|j_	y)N�gui�TEST�testT��_utest)
rr�root�withdrawrr,r8r	r@r()r�r�s  r�
setUpClasszQueryGuiTest.setUpClassAsO������$����4��������[�[��v�v�d�C��
�!�Y�Y�[��
�
�rc�X�|j`|`|jj�|`yr�)r8r(r�r�s rr�zQueryGuiTest.tearDownClassIs&���J�J���J��������Hrc��|jjjdd�d|j_|jjj�y)Nr�end)r8r�deleterr(�
reset_mockr's r�setUpzQueryGuiTest.setUpPs>������� � ��E�*�!����������&�&�(rc�
�|j}|jjdd�|jj	�|j|jd�|j|jj�y�Nr�abc)
r8r�insert�	button_ok�invoker5rrBr(rCr7s  r�
test_click_okzQueryGuiTest.test_click_okUs[�����������A�u�%������!��������.�������-�-�.rc���|j}|jj�|j|jd�|j|jj�yr�)r8rrr5r�assertFalser(rCr7s  r�test_click_blankzQueryGuiTest.test_click_blank\sI�����������!��������-�������.�.�/rc�
�|j}|jjdd�|jj	�|j|jd�|j|jj�yr)
r8rr�
button_cancelrr5rrBr(rCr7s  r�test_click_cancelzQueryGuiTest.test_click_cancelbs[�����������A�u�%����#�#�%��������-�������-�-�.rN)
r)r*r+r�r�r�r�rrrr0rrr�r�?s<���)��)�����)�
/�0�/rr�c�"�eZdZed��Zd�Zy)�SectionnameGuiTestc��td�y�Nr�rr�s rr�zSectionnameGuiTest.setUpClassl�	����rc��t�}|j�tj|dddhd��}|j}|j	|j
dh�|jjdd�|jj�|j	|jd�|j�y)N�T�trTr�r�okay)rr�rrSr5rTrrrrrr()rr�r8r=s    r�test_click_section_namez*SectionnameGuiTest.test_click_section_nameps����t���
�
���#�#�D�#�s�U�G�D�I��� � ������*�*�U�G�4������A�v�&������!��������/����rN)r)r*r+r�r�rr0rrr
r
j�������	rr
c�"�eZdZed��Zd�Zy)�ModulenameGuiTestc��td�yrrr�s rr�zModulenameGuiTest.setUpClass~rrc��t�}|j�tj|dddd��}|j	|j
d�|j	|jj�d�|jj�|j|jd�|j�y)NrrruTr�rv)
rr�rrhr5rirr�rrrwrr(�rr�r8s   r�test_click_module_namez(ModulenameGuiTest.test_click_module_name�s����t���
�
���"�"�4��c�9�T�J��������y�1�������)�)�+�Y�7������!����F�M�M�=�9����rN�r)r*r+r�r�rr0rrrr|s������rrc�"�eZdZed��Zd�Zy)�GotoGuiTestc��td�yrrr�s rr�zGotoGuiTest.setUpClass�rrc�.�t�}|j�tj|ddd��}|jjdd�|jj�|j|jd�|j�y)NrrTr�r�22�)rr�rrrrrrr5rr(rs   rrz"GotoGuiTest.test_click_module_name�si���t���
�
���*�*�T�3��D�9�������A�t�$������!��������+����rNrr0rrrr�s������rrc�"�eZdZed��Zd�Zy)�HelpsourceGuiTestc��td�yrrr�s rr�zHelpsourceGuiTest.setUpClass�rrc���t�}|j�tj|ddtd��}|j
}||jj�d�||jj�t�|jj�tjdk(rdnd}||jd|tzf�|j�y)Nr�__test__T)�menuitem�filepathr�r�r�r)rr�rr�r�r5rr�r�rr�sysr�rr()rr�r8r=r�s     r�test_click_help_sourcez(HelpsourceGuiTest.test_click_help_source�s����t���
�
���"�"�4��z�,4�T�C��� � ��
�f�l�l��� �*�-�
�f�k�k�o�o���*������!�!�l�l�h�6��B��
�f�m�m�j�&�8�*;�<�=����rN)r)r*r+r�r�r,r0rrr%r%�s������rr%c�"�eZdZed��Zd�Zy)�CustomRunGuiTestc��td�yrrr�s rr�zCustomRunGuiTest.setUpClass�rrc��t�}|j�tj|dddgd��}|j	|j
j
�d�|j
jtd�|jj�|j	|jgd�df�|j�y)	N�Titler��b=1T)r�r�za b=1z c)r�r2r�)
rr�rr�r5rr�rrrrrr(rs   r�test_click_argsz CustomRunGuiTest.test_click_args�s����t���
�
���/�/�$��,/��<��F��������)�)�+�W�5������C��&������!�������):�D�(A�B����rN)r)r*r+r�r�r3r0rrr.r.�rrr.�__main__�F)�	verbosity�exit) rur�unittest�test.supportr�test.support.testcaser�tkinterrrr+r	�idlelib.idle_test.mock_tkr
�TestCaserrJrcrzr�r�r�r�r�r�r
rrr%r.r)�mainr0rr�<module>r?s`��
���!�1��
��)�
0J��!�!�0J�f9�h�'�'�9�B!9�X�&�&��!9�H9�x� � �9�:?�x�0�0�?�2*@�8�,�,�*@�Z<�H�-�-�<�29�X�.�.�9�6@�8�,�,�@�.(/�8�$�$�(/�V��*�*��$��)�)�?��"
�(�#�#�
� ��)�)��(�x�(�(��$�z���H�M�M�A�E�*�r