Your IP : 3.128.168.176


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/test_browser.cpython-36.pyc

3

� f2�@s�dZddlmZddlmZddlZddlmZddlmZddl	m
Z
ddlZddlm
Zdd	lmZdd
lmZGdd�dej�ZeZd.\ZZejeded�Zejedd�Zejedd�Zejedd�Zejeddged�Z eje dd�Z!eje dddg�Z"eje"dd �Z#eje#d!d"�Z$ee d#�Z%ej&e%d
�ej&e j'�Gd$d%�d%ej�Z(Gd&d'�d'ej�Z)Gd(d)�d)ej�Z*Gd*d+�d+ej�Z+e,d,k�r�ej-dd-�dS)/zTest browser, coverage 90%.�)�browser)�requiresN)�mock)�Func)�deque)�_pyclbr)�Tk)�TreeNodec@sDeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�ModuleBrowserTestcCs2td�t�|_|jj�tj|jtdd�|_dS)NZguiT)Z_utest)rr�rootZwithdrawrZ
ModuleBrowser�__file__�mb)�cls�r�C/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_browser.py�
setUpClasss
zModuleBrowserTest.setUpClasscCs*|jj�|jj�|jj�|`|`dS)N)r
�closerZupdate_idletasks�destroy)rrrr�
tearDownClasss


zModuleBrowserTest.tearDownClasscCsB|j}|j}||jt�|tji�|j|jt�|j	t
j�dS)N)r
�assertEqual�pathr�pyclbrZ_modules�assertIsInstance�noder	ZassertIsNotNonerZ	file_open)�selfr
�eqrrr�	test_init!szModuleBrowserTest.test_initcCs6|j}|jtjjt�|jj��|j|jj	�d�dS)NzModule Browser)
r
�assertIn�osr�basenamer�top�titlerZiconname)rr
rrr�
test_settitle)szModuleBrowserTest.test_settitlecCs |j}|j�}|j|tj�dS)N)r
Zrootnoderr�ModuleBrowserTreeItem)rr
Zrnrrr�
test_rootnode.szModuleBrowserTest.test_rootnodecCsR|j}t�|j_t�|j_|j�|j|jjj�|j|jjj�|j`|j`dS)N)r
rr rrr�
assertTrueZcalled)rr
rrr�
test_close3s

zModuleBrowserTest.test_closeN)
�__name__�
__module__�__qualname__�classmethodrrrr"r$r&rrrrr
sr
�test�test.py�f0��f1��f2��c1��C0�base��F1��C1���C2��F3�)r-r5c@seZdZdd�Zdd�ZdS)�TransformChildrenTestcCs�|j}tj}t|td��}||ttg�||djd�||djd�t|td��}||djd�t|td��}||g�dS)Nr+rr-r.zC0(base)zdifferent name)rr�transform_children�list�mock_pyclbr_treer-r5�name)rr�	transform�tclrrr�test_transform_module_childrenUsz4TransformChildrenTest.test_transform_module_childrencCs�|j}tj}t|tj��}||ttg�||djd�||djd�t|tj��}||djd�|t|t	j��t
tg�dS)Nrr8r.zC1())rrrBrCr5�childrenr8r:rEr-r/r3)rrrFrGrrr�test_transform_node_childrendsz2TransformChildrenTest.test_transform_node_childrenN)r'r(r)rHrJrrrrrASsrAc@sZeZdZedd��Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
ejd�dd��Z
dS)�ModuleBrowserTreeItemTestcCstjt�|_dS)N)rr#�fname�mbt)rrrrrtsz$ModuleBrowserTreeItemTest.setUpClasscCs|j|jjt�dS)N)rrM�filerL)rrrrrxsz#ModuleBrowserTreeItemTest.test_initcCs|j|jj�t�dS)N)rrM�GetTextrL)rrrr�test_gettext{sz&ModuleBrowserTreeItemTest.test_gettextcCs|j|jj�d�dS)N�python)rrM�GetIconName)rrrr�test_geticonname~sz*ModuleBrowserTreeItemTest.test_geticonnamecCs|j|jj��dS)N)r%rM�IsExpandable)rrrr�test_isexpandable�sz+ModuleBrowserTreeItemTest.test_isexpandablecCs\tjj}tj}ttd�tj_tttgd�t_z|j|j	j
�ttg�Wd|tj_|t_XdS)N)�result)rrZ
readmodule_exrBrrDr-r5rrM�listchildren)rZsave_rexZsave_tcrrr�test_listchildren�sz+ModuleBrowserTreeItemTest.test_listchildrencCsb|j}tttgd�|_|j�\}}|`|j|tj�|j|tj�|j	|j
d�|j	|j
d�dS)N)rVr-zC0(base))rMrr-r5rW�
GetSubListrr�ChildBrowserTreeItemrrE)rrMZsub0Zsub1rrr�test_getsublist�sz)ModuleBrowserTreeItemTest.test_getsublistzidlelib.browser.file_opencCsh|j}tjddd��|j�|j�WdQRXtjddd�� |j�|j�|jt�WdQRXdS)Nzos.path.existsF)�return_valueT)rMr�patch�
OnDoubleClickZassert_not_called�
assert_calledZcalled_withrL)r�fopenrMrrr�test_ondoubleclick�sz,ModuleBrowserTreeItemTest.test_ondoubleclickN)r'r(r)r*rrrPrSrUrXr[rr]rarrrrrKrs
rKc@s^eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
ejd�dd��Z
dS)�ChildBrowserTreeItemTestcCs(tj}|t�|_|t�|_|t�|_dS)N)rrZr/�cbt_f1r:�cbt_C1r8�cbt_F1)r�CBTrrrr�s

z#ChildBrowserTreeItemTest.setUpClasscCs|`|`|`dS)N)rdrcre)rrrrr�sz&ChildBrowserTreeItemTest.tearDownClasscCsB|j}||jjd�|j|jj�||jjd�|j|jj�dS)NzC1()r/)rrdrE�assertFalseZ
isfunctionrcr%)rrrrrr�s
z"ChildBrowserTreeItemTest.test_initcCs(|j|jj�d�|j|jj�d�dS)Nz
class C1()zdef f1(...))rrdrOrc)rrrrrP�sz%ChildBrowserTreeItemTest.test_gettextcCs(|j|jj�d�|j|jj�d�dS)N�folderrQ)rrdrRrc)rrrrrS�sz)ChildBrowserTreeItemTest.test_geticonnamecCs4|j|jj��|j|jj��|j|jj��dS)N)r%rdrTrcrgre)rrrrrU�sz*ChildBrowserTreeItemTest.test_isexpandablecCsX|j}tj}|jj�}|j|d|�|t|�d�||djd�||jj�g�dS)Nrr.r1)	rrrZrcrYr�lenrEre)rrrfZ	f1sublistrrrr[�s
z(ChildBrowserTreeItemTest.test_getsublistzidlelib.browser.file_opencCs>tj�}|j_|jj�|j�|j�|j|jjj	�dS)N)
rZMockr\Zgotolinerer^r_Zassert_called_with�obj�lineno)rr`Zgotorrrra�s

z+ChildBrowserTreeItemTest.test_ondoubleclickN)r'r(r)r*rrrrPrSrUr[rr]rarrrrrb�srbc@seZdZdZdd�ZdS)�NestedChildrenTestzFTest that all the nodes in a nested tree are added to the BrowserTree.c	Cs�t�}g}ddddddddd	g	}tj}|j|t�|t�f�xd|r�|j�}|j�}|j|�|j|j	|j
��|j|j�d�|j|j
�|gk�|j|j	�q>W|j||�dS)
Nr-zC0(base)r/r3r8zC1()r1r=r?rQrh)rQrh)rrrZ�extendr-r5�popleftrYrrErOrRZassertIsrT�appendr)rZqueueZactual_namesZexpected_namesrf�cbZsublistrrr�test_nested�s"
zNestedChildrenTest.test_nestedN)r'r(r)�__doc__rqrrrrrl�srl�__main__)�	verbosity)r+r,).rrZidlelibrZtest.supportrZunittestrZidlelib.idle_test.mock_idler�collectionsrZos.pathrrrZtkinterrZidlelib.treer	ZTestCaser
r
�modulerLZFunctionr-Z_nest_functionr/r1Z_nest_classr3ZClassr5r8r:r=r?rDrBrIrArKrbrlr'�mainrrrr�<module>s>-
56


?>