
    /hh               	       b   S r SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SSKJr  SSKrSSKrSS	KJr  SS
KJr   " S S\R(                  5      r\rSu  rr\R3                  \SS/\SSS9r\R7                  \SSS5      r\R;                  \SSSS/5      r\R;                  \SSS5      r\R7                  \SSS5      r \RC                  \S\SSS9r"\R7                  \"SS S!5      r#\R7                  \#S"S#S#5      r$\R;                  \"S$SS5      r%\\"S%.r&\RN                  " \&S&5        \RN                  " \RP                  5         " S' S(\R(                  5      r) " S) S*\R(                  5      r* " S+ S,\R(                  5      r+ " S- S.\R(                  5      r,\-S/:X  a  \R\                  " S0S19  gg)2zTest browser, coverage 90%.    )browser)requiresN)mock)Func)py_extensions)deque)Tk)TreeNodec                   R    \ rS rSr\S 5       r\S 5       rS rS rS r	S r
S rS	rg
)ModuleBrowserTest   c                     [        S5        [        5       U l        U R                  R                  5         [        R
                  " U R                  [        SS9U l        g )NguiT)_utest)r   r	   rootwithdrawr   ModuleBrowser__file__mbclss    G/opt/python-3.13.8/usr/lib/python3.13/idlelib/idle_test/test_browser.py
setUpClassModuleBrowserTest.setUpClass   s<    4&&sxx$G    c                     U R                   R                  5         U R                  R                  5         U R                  R	                  5         U ?U ? g N)r   closer   update_idletasksdestroyr   s    r   tearDownClassModuleBrowserTest.tearDownClass   s8    !!#Hcfr   c                    U R                   nU R                  nU" UR                  [        5        U" [        R
                  0 5        U R                  UR                  [        5        U R                  [        R                  5        g r   )r   assertEqualpathr   pyclbr_modulesassertIsInstancenoder
   assertIsNotNoner   	file_open)selfr   eqs      r   	test_initModuleBrowserTest.test_init"   sZ    WW
277H
6??Bbggx0W../r   c                    U R                   nU R                  [        R                  R	                  [
        5      UR                  R                  5       5        U R                  UR                  R                  5       S5        g )NzModule Browser)
r   assertInosr%   basenamer   toptitler$   iconnamer,   r   s     r   test_settitleModuleBrowserTest.test_settitle*   sN    WWbgg&&x0"&&,,.A*,<=r   c                 |    U R                   nUR                  5       nU R                  U[        R                  5        g r   )r   rootnoder(   r   ModuleBrowserTreeItem)r,   r   rns      r   test_rootnodeModuleBrowserTest.test_rootnode/   s,    WW[[]b'"?"?@r   c                    U R                   n[        5       UR                  l        [        5       UR                  l        UR                  5         U R                  UR                  R                  R                  5        U R                  UR                  R                  R                  5        UR                  ?UR                  ?g r   )r   r   r4   r    r)   r   
assertTruecalledr7   s     r   
test_closeModuleBrowserTest.test_close4   ss    WW&

--.../FFNBGGOr   c                     Sn[          H[  nU R                  US9   U U 3n[        R                  " U5      nU[        R                  ;  nU R                  XE5        S S S 5        M]     g ! , (       d  f       Mo  = f)Nz/path/to/file)ext)r   subTestr   is_browseable_extensionbrowseable_extension_blocklistr$   )r,   r%   rF   filenameactualexpecteds         r   test_is_browseable_extension.ModuleBrowserTest.test_is_browseable_extension=   si     C#&"VC5> 88Bg&L&LL  2	 '& !&&s   AA))
A8	 N)__name__
__module____qualname____firstlineno__classmethodr   r!   r.   r8   r>   rC   rM   __static_attributes__rO   r   r   r   r      sD    H H  0>
A
,3r   r   )testztest.pyC0base   	   )
end_linenoF1      C1    C2   F3f0      f1      f2   c1)rW   re   rV   c                        \ rS rSrS rS rSrg)TransformChildrenTest]   c                 |   U R                   n[        R                  n[        U" [        S5      5      nU" U[
        [        /5        U" US   R                  S5        U" US   R                  S5        [        U" [        S5      5      nU" US   R                  S5        [        U" [        S5      5      nU" U/ 5        g )NrV   r   C0(base)rY   re   zdifferent name)r$   r   transform_childrenlistmock_pyclbr_treerW   re   namer,   r-   	transformtcls       r   test_transform_module_children4TransformChildrenTest.test_transform_module_children_   s    ..	9-v67
3R
3q6;;
#
3q6;;9-v67
3q6;;
#9-/?@A
3r   c                    U R                   n[        R                  n[        U" [        R
                  5      5      nU" U[        [        /5        U" US   R                  S5        U" US   R                  S5        [        U" [        R
                  5      5      nU" US   R                  S5        U" [        U" [        R
                  5      5      [        [        /5        g )Nr   r\   rY   C1())r$   r   rs   rt   rW   childrenr\   r_   rv   re   rh   rm   rw   s       r   test_transform_node_children2TransformChildrenTest.test_transform_node_childrenn   s    ..	9R[[)*
3R
3q6;;
3q6;;9R[[)*
3q6;;
4	"++&'"b2r   rO   N)rP   rQ   rR   rS   rz   r   rU   rO   r   r   ro   ro   ]   s    3r   ro   c                   x    \ rS rSr\S 5       rS rS rS rS r	S r
S r\R                  " S	5      S
 5       rSrg)ModuleBrowserTreeItemTest|   c                 B    [         R                  " [        5      U l        g r   )r   r<   fnamembtr   s    r   r   $ModuleBrowserTreeItemTest.setUpClass~   s    //6r   c                 X    U R                  U R                  R                  [        5        g r   )r$   r   filer   r,   s    r   r.   #ModuleBrowserTreeItemTest.test_init   s    .r   c                 `    U R                  U R                  R                  5       [        5        g r   )r$   r   GetTextr   r   s    r   test_gettext&ModuleBrowserTreeItemTest.test_gettext   s    ))+U3r   c                 X    U R                  U R                  R                  5       S5        g )Npython)r$   r   GetIconNamer   s    r   test_geticonname*ModuleBrowserTreeItemTest.test_geticonname   s    --/:r   c                 V    U R                  U R                  R                  5       5        g r   )rA   r   IsExpandabler   s    r   test_isexpandable+ModuleBrowserTreeItemTest.test_isexpandable   s    --/0r   c                    [         R                  R                  n[         R                  n[	        [
        S9[         R                  l        [	        [        [        /S9[         l         U R                  U R                  R                  5       [        [        /5        U[         R                  l        U[         l        g ! U[         R                  l        U[         l        f = f)Nresult)r   r&   readmodule_exrs   r   ru   re   rW   r$   r   listchildren)r,   save_rexsave_tcs      r   test_listchildren+ModuleBrowserTreeItemTest.test_listchildren   s    >>//,,'+3C'D$%)"b%:"	1TXX224r2h?+3GNN()0G& ,4GNN()0G&s   (4B= ="Cc                 d   U R                   n[        [        [        /S9Ul        UR                  5       u  p#U?U R                  U[        R                  5        U R                  U[        R                  5        U R                  UR                  S5        U R                  UR                  S5        g )Nr   re   rr   )r   r   re   rW   r   
GetSubListr(   r   ChildBrowserTreeItemr$   rv   )r,   r   sub0sub1s       r   test_getsublist)ModuleBrowserTreeItemTest.test_getsublist   s    hhBx0^^%
dG$@$@AdG$@$@AD)J/r   idlelib.browser.file_openc                 b   U R                   n[        R                  " SSS9   UR                  5         UR	                  5         S S S 5        [        R                  " SSS9   UR                  5         UR                  [        5        S S S 5        g ! , (       d  f       NR= f! , (       d  f       g = f)Nzos.path.existsF)return_valueT)r   r   patchOnDoubleClickassert_not_calledassert_called_once_withr   )r,   fopenr   s      r   test_ondoubleclick,ModuleBrowserTreeItemTest.test_ondoubleclick   s|    hhZZ(u=##% > ZZ(t<))%0 =<	 >= =<s   !B &B 
B 
B.rO   N)rP   rQ   rR   rS   rT   r   r.   r   r   r   r   r   r   r   r   rU   rO   r   r   r   r   |   sP    7 7/4;1	10 
ZZ+,	1 -	1r   r   c                       \ rS rSr\S 5       r\S 5       rS rS rS r	S r
S r\R                  " S	5      S
 5       rSrg)ChildBrowserTreeItemTest   c                     [         R                  nU" [        5      U l        U" [        5      U l        U" [        5      U l        g r   )r   r   rh   cbt_f1r_   cbt_C1r\   cbt_F1)r   CBTs     r   r   #ChildBrowserTreeItemTest.setUpClass   s.    **W
W
W
r   c                     U ? U ?U ?g r   )r   r   r   r   s    r   r!   &ChildBrowserTreeItemTest.tearDownClass   s    J
CJr   c                 $   U R                   nU" U R                  R                  S5        U R                  U R                  R                  5        U" U R
                  R                  S5        U R                  U R
                  R                  5        g )Nr}   rh   )r$   r   rv   assertFalse
isfunctionr   rA   )r,   r-   s     r   r.   "ChildBrowserTreeItemTest.test_init   sc    
4;;V$//0
4;;T"../r   c                     U R                  U R                  R                  5       S5        U R                  U R                  R                  5       S5        g )Nz
class C1()zdef f1(...))r$   r   r   r   r   s    r   r   %ChildBrowserTreeItemTest.test_gettext   s<    ,,.=,,.>r   c                     U R                  U R                  R                  5       S5        U R                  U R                  R                  5       S5        g )Nfolderr   )r$   r   r   r   r   s    r   r   )ChildBrowserTreeItemTest.test_geticonname   s<    002H=002H=r   c                     U R                  U R                  R                  5       5        U R                  U R                  R                  5       5        U R	                  U R
                  R                  5       5        g r   )rA   r   r   r   r   r   r   s    r   r   *ChildBrowserTreeItemTest.test_isexpandable   sO    002300231134r   c                 ,   U R                   n[        R                  nU R                  R	                  5       nU R                  US   U5        U" [        U5      S5        U" US   R                  S5        U" U R                  R	                  5       / 5        g )Nr   rY   rk   )	r$   r   r   r   r   r(   lenrv   r   )r,   r-   r   	f1sublists       r   r   (ChildBrowserTreeItemTest.test_getsublist   sw    **KK**,	ilC0
3y>1
9Q<d#
4;;!!#R(r   r   c                     [         R                  " 5       =o!R                  l        U R                  R                  5         UR                  5         UR                  5         UR                  U R                  R                  R                  5        g r   )
r   Mockr   gotoliner   r   assert_calledassert_called_withobjlineno)r,   r   gotos      r   r   +ChildBrowserTreeItemTest.test_ondoubleclick   s]    -1YY[8!!*!!# 6 67r   rO   N)rP   rQ   rR   rS   rT   r   r!   r.   r   r   r   r   r   r   r   rU   rO   r   r   r   r      s_      / /0?>5
	) 
ZZ+,8 -8r   r   c                       \ rS rSrSrS rSrg)NestedChildrenTest   zFTest that all the nodes in a nested tree are added to the BrowserTree.c                 F   [        5       n/ n/ SQn[        R                  nUR                  U" [        5      U" [
        5      45        U(       a  UR                  5       nUR                  5       nUR                  U5        U R                  UR                  UR                  5       5        U R                  UR                  5       S5        U R                  UR                  5       U/ :g  5        UR                  UR                  5        U(       a  M  U R                  X#5        g )N)	re   rr   rh   rm   r\   r}   rk   rb   rd   )r   r   )r   r   r   extendre   rW   popleftr   r1   rv   r   r   assertIsr   appendr$   )r,   queueactual_namesexpected_namesr   cbsublists          r   test_nestedNestedChildrenTest.test_nested   s      **c"gs2w'(BmmoGLL!MM"''2::<0MM"..*,@AMM"//+W];( e 	6r   rO   N)rP   rQ   rR   rS   __doc__r   rU   rO   r   r   r   r      s
    L7r   r   __main__   )	verbosity)/r   idlelibr   test.supportr   unittestr   idlelib.idle_test.mock_idler   idlelib.utilr   collectionsr   os.pathr2   r&   tkinterr	   idlelib.treer
   TestCaser   r   moduler   ClassrW   _nest_functionr\   _nest_classr_   rb   rd   Functionre   rh   rk   rm   ru   rs   r~   ro   r   r   r   rP   mainrO   r   r   <module>r      s     !   , &     !23)) 23l !XXfdVHeQ1X=r4A&^^BaRD)^^Ba#r4A&[[ubR[8r4R(r4R(^^Bb"%B'    +V 4   2;; '3H-- 3>11 1 1 11h28x00 28l7** 74 zMMA r   