HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/idlelib/idle_test/__pycache__/test_query.cpython-310.opt-2.pyc
o

�i^<�@s~	ddlmZddlZddlmZddlmZmZddlZddlm	Z	ddl
mZGdd�dej�Z
Gd	d
�d
ej�ZGdd�dej�ZGd
d�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd �d ej�ZGd!d"�d"ej�ZGd#d$�d$ej�Zed%kr�ejd&d'd(�dSdS))�)�queryN��requires)�Tk�END)�mock)�Varc@sDeZdZ	Gdd�d�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�	QueryTestc@s<eZdZejjZejjZejjZdd�Zdd�Z	dd�Z
dS)zQueryTest.Dummy_QuerycCs&t|d�|_ddi|_d|_d|_dS)N��value�text�F)r�entry�entry_error�result�	destroyed��selfZdummy_entry�r�9/usr/local/lib/python3.10/idlelib/idle_test/test_query.py�__init__!s

zQueryTest.Dummy_Query.__init__cC�||jd<dS�Nr�r�r�messagerrr�	showerror&�zQueryTest.Dummy_Query.showerrorcCs
d|_dS�NT)r�rrrr�destroy(s
zQueryTest.Dummy_Query.destroyN)�__name__�
__module__�__qualname__r�Query�entry_ok�ok�cancelrrr rrrr�Dummy_Querysr(cCsD|�d�}|�|��d�|�|j|jfd�|�d|jd�dS)N� �NFz
blank liner)r(�assertEqualr%rr�assertInr�r�dialogrrr�test_entry_ok_blank+s
zQueryTest.test_entry_ok_blankcCsD|�d�}|j}||��d�||j|jfd�||jdd�dS)N�  good �goodr*rr
)r(r+r%rrr)rr.�Equalrrr�test_entry_ok_good1s

zQueryTest.test_entry_ok_goodcCsT|�d�}t��|j_|�|��d�|�|jjj�|j`|�|j	|j
fd�dS)Nr
r*)r(r�MockrZ	focus_setr+r&�
assertTrue�calledrrr-rrr�
test_ok_blank8s
zQueryTest.test_ok_blankcC�2|�d�}|�|��d�|�|j|jfd�dS)Nr1)r1T)r(r+r&rrr-rrr�test_ok_good@�
zQueryTest.test_ok_goodcCr8)Nzdoes not matterr)r(r+r'rrr-rrr�test_cancelEr:zQueryTest.test_cancelN)	r!r"r#r(r/r3r7r9r;rrrrr	sr	c@�<eZdZ	Gdd�d�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SectionNameTestc@s*eZdZejjZdgZdd�Zdd�ZdS)z!SectionNameTest.Dummy_SectionName�usedcC�t|d�|_ddi|_dS�Nr
rr
�rrrrrrrrQ�z*SectionNameTest.Dummy_SectionName.__init__cCrrrrrrrrTrz+SectionNameTest.Dummy_SectionName.showerrorN)	r!r"r#r�SectionNamer%�
used_namesrrrrrr�Dummy_SectionNameNs
rEcC�0|�d�}|�|��d�|�d|jd�dS�Nr)zno namer�rEr+r%r,rr-rrr�test_blank_section_nameW�
z'SectionNameTest.test_blank_section_namecCrF)Nr>ZuserrHr-rrr�test_used_section_name\rJz&SectionNameTest.test_used_section_namecCrF)NZ goodgoodgoodgoodgoodgoodgoodgoodzlonger than 30rrHr-rrr�test_long_section_namearJz&SectionNameTest.test_long_section_namecC�0|�d�}|�|��d�|�|jdd�dS)Nr0r1rr
)rEr+r%rr-rrr�test_good_section_namefrJz&SectionNameTest.test_good_section_nameN)r!r"r#rErIrKrLrNrrrrr=K�	r=c@r<)�ModuleNameTestc@s(eZdZejjZdZdd�Zdd�ZdS)zModuleNameTest.Dummy_ModuleNamer
cCr?r@rArrrrrrrBz(ModuleNameTest.Dummy_ModuleName.__init__cCrrrrrrrrurz)ModuleNameTest.Dummy_ModuleName.showerrorN)	r!r"r#r�
ModuleNamer%�text0rrrrrr�Dummy_ModuleNameos
rScCrFrG�rSr+r%r,rr-rrr�test_blank_module_namexrJz%ModuleNameTest.test_blank_module_namecCrF)NZ __name_xyz123_should_not_exist__z	not foundrrTr-rrr�test_bogus_module_name}rJz%ModuleNameTest.test_bogus_module_namecCrF)N�	itertoolszsource-basedrrTr-rrr�test_c_source_name�rJz!ModuleNameTest.test_c_source_namecCsd|�d�}|�|���d��|�|jdd�|�d�}|�|���d��|�|jdd�dS)N�idlelib�__init__.pyrr
zidlelib.idlezidle.py)rSr5r%�endswithr+rr-rrr�test_good_module_name�s

z$ModuleNameTest.test_good_module_nameN)r!r"r#rSrUrVrXr\rrrrrPlrOrPc@�4eZdZ	Gdd�d�Zdd�Zdd�Zdd�Zd	S)
�GotoTestc@�$eZdZejjZdd�Zdd�ZdS)zGotoTest.Dummy_ModuleNamecCr?r@rArrrrr�rBz"GotoTest.Dummy_ModuleName.__init__cCrrrrrrrr�rz#GotoTest.Dummy_ModuleName.showerrorN)r!r"r#r�Gotor%rrrrrrrS��rScCrF)N�aznot a base 10 integerrrTr-rrr�test_bogus_goto�rJzGotoTest.test_bogus_gotocCrF)N�0znot a positive integerrrTr-rrr�
test_bad_goto�rJzGotoTest.test_bad_gotocCrM)N�1�rr
)rSr+r%rr-rrr�test_good_goto�rJzGotoTest.test_good_gotoN)r!r"r#rSrcrerhrrrrr^�sr^c@�$eZdZ	Gdd�d�Zdd�ZdS)�HelpsourceBrowsefileTestc@seZdZejjZe�ZdS)z)HelpsourceBrowsefileTest.Dummy_HelpSourceN)r!r"r#r�
HelpSource�browse_filer�pathvarrrrr�Dummy_HelpSource�s
rnc	Cs�|��}ddd�dfddd�tfddd�dfddd�tffD]/\}}}|���|j�|�||_|��|�|j��|�Wd�n1sHwYqdS)Nr
cS�dS�Nr
r�rb�b�crrr�<lambda>��zBHelpsourceBrowsefileTest.test_file_replaces_path.<locals>.<lambda>cS�tS�N��__file__rqrrrrt�ruZhtestcSrorprrqrrrrt�rucSrvrwrxrqrrrrt�ru)	rnry�subTestrm�setZaskfilenamerlr+�get)rr.�path�funcrrrr�test_file_replaces_path�s�
���z0HelpsourceBrowsefileTest.test_file_replaces_pathN)r!r"r#rnrrrrrrj�srjc@sNeZdZ	Gdd�d�ZejZedd��Zdd�Z	dd�Z
d	d
�Zdd�Zd
S)�HelpsourcePathokTestc@s&eZdZejjZdd�Zddd�ZdS)z%HelpsourcePathokTest.Dummy_HelpSourcecCr?r@)rr}�
path_error)rZ
dummy_pathrrrr�rBz.HelpsourcePathokTest.Dummy_HelpSource.__init__NcCrr)r�)rrZwidgetrrrr�rz/HelpsourcePathokTest.Dummy_HelpSource.showerrorrw)r!r"r#rrk�path_okrrrrrrrn�srncCs|jt_dSrw)�
orig_platformr�platform��clsrrr�
tearDownClass��z"HelpsourcePathokTest.tearDownClasscCrF)Nr)zno help filer)rnr+r�r,r�r-rrr�test_path_ok_blank�rJz'HelpsourcePathokTest.test_path_ok_blankcCs4|�td�}|�|��d�|�d|jd�dS)Nzbad-bad-badz	not existr)rnryr+r�r,r�r-rrr�test_path_ok_bad�sz%HelpsourcePathokTest.test_path_ok_badc	Cst|�d�}|j}dD]-}|���|j�|�|�|��|�|�|jdd�Wd�n1s2wYq
dS)Nr
)z
www.py.orgz
http://py.orgr)rnr+rzr}r{r�r�)rr.r2�urlrrr�test_path_ok_web�s

���z%HelpsourcePathokTest.test_path_ok_webc	Cs||�d�}dD]4\}}|���$|t_|j�t�|�|��|t�|�|j	dd�Wd�n1s6wYqdS)Nr
))�darwin�file://)�otherr
r)
rnrzrr�r}r{ryr+r�r�)rr.r��prefixrrr�test_path_ok_file�s

���z&HelpsourcePathokTest.test_path_ok_fileN)
r!r"r#rnrr�r��classmethodr�r�r�r�r�rrrrr��s
	r�c@ri)�HelpsourceEntryokTestc@s,eZdZejjZiZiZdd�Zdd�Z	dS)z&HelpsourceEntryokTest.Dummy_HelpSourcecC�|jSrw)�namerrrr�item_ok��z.HelpsourceEntryokTest.Dummy_HelpSource.item_okcCr�rw)r}rrrrr��r�z.HelpsourceEntryokTest.Dummy_HelpSource.path_okN)
r!r"r#rrkr%rr�r�r�rrrrrn�srnc	Csb|��}dD](\}}}|���|||_|_|�|��|�Wd�n1s)wYqdS)N))NNN)N�doc.txtN)�docNN)r�r�)r�r�)rnrzr�r}r+r%)rr.r�r}rrrr�test_entry_ok_helpsource�s
���z.HelpsourceEntryokTest.test_entry_ok_helpsourceN)r!r"r#rnr�rrrrr��s	r�c@r])
�CustomRunCLIargsokTestc@r_)z&CustomRunCLIargsokTest.Dummy_CustomRuncCr?r@rArrrrrrBz/CustomRunCLIargsokTest.Dummy_CustomRun.__init__cCrrrrrrrrrz0CustomRunCLIargsokTest.Dummy_CustomRun.showerrorN)r!r"r#r�	CustomRun�cli_args_okrrrrrr�Dummy_CustomRunrar�cCs|�d�}|�|��g�dS)Nr))r�r+r�r-rrr�test_blank_argss
z&CustomRunCLIargsokTest.test_blank_argscCrF)Nz'no-closing-quotez
No closingr)r�r+r�r,rr-rrr�test_invalid_argsrJz(CustomRunCLIargsokTest.test_invalid_argscCsHgd�}|�d�|�d�}|�|��|dg�|�|jdd�dS)N)z-nZ10z	--verbosez-pz/pathz--namer)z
 "my name"zmy namerr
)r��joinr+r�r)r�argsr.rrr�test_good_args sz%CustomRunCLIargsokTest.test_good_argsN)r!r"r#r�r�r�r�rrrrr�sr�c@ri)�CustomRunEntryokTestc@s&eZdZejjZiZe�Zdd�Z	dS)z$CustomRunEntryokTest.Dummy_CustomRuncCr�rw)�cli_argsrrrrr�.r�z0CustomRunEntryokTest.Dummy_CustomRun.cli_args_okN)
r!r"r#rr�r%rr�
restartvarr�rrrrr�*s
r�c
Cs�|��}dD]9}|j�|�ddgdg|fffD]&\}}|j||d��||_|�|��|�Wd�n1s9wYqqdS)N>FT)NNzmy arg)�restartr�)r�r�r{rzr�r+r%)rr.r�r�rrrr�test_entry_ok_customrun1s�����z,CustomRunEntryokTest.test_entry_ok_customrunN)r!r"r#r�r�rrrrr�'sr�c@sDeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�QueryGuiTestcCsBtd�t�|_}|j��tj|dddd�|_t��|j_	dS)N�guiZTEST�testT��_utest)
rr�root�withdrawrr$r.rr4r )r�r�rrr�
setUpClass@s

zQueryGuiTest.setUpClasscCs|j`|`|j��|`dSrw)r.r r�r�rrrr�Hs
zQueryGuiTest.tearDownClasscCs(|jj�dd�d|j_|jj��dS)Nr�end)r.r�deleterr Z
reset_mockrrrr�setUpOszQueryGuiTest.setUpcCs>|j}|j�dd�|j��|�|jd�|�|jj	�dS�Nr�abc)
r.r�insert�	button_ok�invoker+rr5r r6r-rrr�
test_click_okT�

zQueryGuiTest.test_click_okcCs0|j}|j��|�|jd�|�|jj�dSrw)r.r�r�r+rZassertFalser r6r-rrr�test_click_blank[s
zQueryGuiTest.test_click_blankcCs>|j}|j�dd�|j��|�|jd�|�|jj	�dSr�)
r.rr�Z
button_cancelr�r+rr5r r6r-rrr�test_click_cancelar�zQueryGuiTest.test_click_cancelN)
r!r"r#r�r�r�r�r�r�r�rrrrr�>s

r�c@� eZdZedd��Zdd�ZdS)�SectionnameGuiTestcC�td�dS�Nr�rr�rrrr�kr�zSectionnameGuiTest.setUpClasscCslt�}|��tj|dddhdd�}|j}|�|jdh�|j�dd�|j�	�|�|j
d�|��dS)N�T�tr�Tr�rZokay)rr�rrCr+rDrr�r�r�rr )rr�r.r2rrr�test_click_section_nameos
z*SectionnameGuiTest.test_click_section_nameN)r!r"r#r�r�r�rrrrr�i�
r�c@r�)�ModulenameGuiTestcCr�r�rr�rrrr�}r�zModulenameGuiTest.setUpClasscCsjt�}|��tj|ddddd�}|�|jd�|�|j��d�|j�	�|�
|j�d��|�
�dS)Nr�r�rYTr�rZ)rr�rrQr+rRrr|r�r�r5rr[r �rr�r.rrr�test_click_module_name�s
z(ModulenameGuiTest.test_click_module_nameN�r!r"r#r�r�r�rrrrr�{r�r�c@r�)�GotoGuiTestcCr�r�rr�rrrr��r�zGotoGuiTest.setUpClasscCsRt�}|��tj|dddd�}|j�dd�|j��|�|j	d�|�
�dS)Nr�r�Tr�rZ22�)rr�rr`rr�r�r�r+rr r�rrrr��s
z"GotoGuiTest.test_click_module_nameNr�rrrrr��r�r�c@r�)�HelpsourceGuiTestcCr�r�rr�rrrr��r�zHelpsourceGuiTest.setUpClasscCs�t�}|��tj|ddtdd�}|j}||j��d�||j��t�|j	�
�tjdkr0dnd}||j
d|tf�|��dS)Nr�Z__test__T)Zmenuitem�filepathr�r�r�r
)rr�rrkryr+rr|r}r�r��sysr�rr )rr�r.r2r�rrr�test_click_help_source�s
�
z(HelpsourceGuiTest.test_click_help_sourceN)r!r"r#r�r�r�rrrrr��r�r�c@r�)�CustomRunGuiTestcCr�r�rr�rrrr��r�zCustomRunGuiTest.setUpClasscCspt�}|��tj|dddgdd�}|�|j��d�|j�td�|j	�
�|�|jgd�df�|��dS)	NZTitlerb�b=1T)r�r�za b=1z c)rbr�rs)
rr�rr�r+rr|r�rr�r�rr r�rrr�test_click_args�s�
z CustomRunGuiTest.test_click_argsN)r!r"r#r�r�r�rrrrr��r�r��__main__�F)�	verbosity�exit)rYrZunittestZtest.supportr�tkinterrrr�rZidlelib.idle_test.mock_tkrZTestCaser	r=rPr^rjr�r�r�r�r�r�r�r�r�r�r!�mainrrrr�<module>s43!$-+�