<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
2a-                 @   s"  d dl mZ d dlZd dlmZ d dlmZ d dlZd dlmZ d dl	m
Z
 G dd dejZG d	d
 d
ejZG dd dejZejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZG dd dejZedkrejddd dS )    )queryN)requires)Tk)mock)Varc               @   sB   e Zd ZG dd dZdd Zdd Zdd Zd	d
 Zdd ZdS )	QueryTestc               @   sF   e Zd ZejjZejjZejjZe Z	i Z
dd Zdd Zdd ZdS )zQueryTest.Dummy_Queryc             C   s&   | j j| d| jd< d | _d| _d S )N textF)entrysetentry_errorresult	destroyed)selfdummy_entry r   //opt/alt/python36/lib64/python3.6/test_query.py__init__#   s    
zQueryTest.Dummy_Query.__init__c             C   s   || j d< d S )Nr	   )r   )r   messager   r   r   	showerror(   s    zQueryTest.Dummy_Query.showerrorc             C   s
   d| _ d S )NT)r   )r   r   r   r   destroy*   s    zQueryTest.Dummy_Query.destroyN)__name__
__module____qualname__r   Queryentry_okokcancelr   r
   r   r   r   r   r   r   r   r   Dummy_Query   s   r   c             C   sD   | j d}| j|j d  | j|j|jfd | jd|jd  d S )N Fz
blank liner	   )NF)r   assertEqualr   r   r   assertInr   )r   dialogr   r   r   test_entry_ok_blank-   s    
zQueryTest.test_entry_ok_blankc             C   sD   | j d}| j}||j d ||j|jfd ||jd d d S )Nz  good goodFr	   r   )NF)r   r    r   r   r   r   )r   r"   Equalr   r   r   test_entry_ok_good3   s
    
zQueryTest.test_entry_ok_goodc             C   sT   | j d}tj |j_| j|j d  | j|jjj |j`| j|j	|j
fd d S )Nr   F)NF)r   r   Mockr
   Z	focus_setr    r   
assertTruecalledr   r   )r   r"   r   r   r   test_ok_blank:   s    
zQueryTest.test_ok_blankc             C   s2   | j d}| j|j d  | j|j|jfd d S )Nr$   T)r$   T)r   r    r   r   r   )r   r"   r   r   r   test_ok_goodB   s    
zQueryTest.test_ok_goodc             C   s2   | j d}| j|j d  | j|j|jfd d S )Nzdoes not matterT)NT)r   r    r   r   r   )r   r"   r   r   r   test_cancelG   s    
zQueryTest.test_cancelN)	r   r   r   r   r#   r&   r*   r+   r,   r   r   r   r   r      s   r   c               @   s:   e Zd ZG dd dZdd Zdd Zdd Zd	d
 ZdS )SectionNameTestc               @   s4   e Zd ZejjZdgZe Zi Z	dd Z
dd ZdS )z!SectionNameTest.Dummy_SectionNameusedc             C   s   | j j| d| jd< d S )Nr   r	   )r
   r   r   )r   r   r   r   r   r   U   s    z*SectionNameTest.Dummy_SectionName.__init__c             C   s   || j d< d S )Nr	   )r   )r   r   r   r   r   r   X   s    z+SectionNameTest.Dummy_SectionName.showerrorN)r   r   r   r   SectionNamer   
used_namesr   r
   r   r   r   r   r   r   r   Dummy_SectionNameP   s   r1   c             C   s0   | j d}| j|j d  | jd|jd  d S )Nr   zno namer	   )r1   r    r   r!   r   )r   r"   r   r   r   test_blank_section_name[   s    
z'SectionNameTest.test_blank_section_namec             C   s0   | j d}| j|j d  | jd|jd  d S )Nr.   Zuser	   )r1   r    r   r!   r   )r   r"   r   r   r   test_used_section_name`   s    
z&SectionNameTest.test_used_section_namec             C   s4   | j dd }| j|j d  | jd|jd  d S )Nr$      zlonger than 30r	   )r1   r    r   r!   r   )r   r"   r   r   r   test_long_section_namee   s    z&SectionNameTest.test_long_section_namec             C   s0   | j d}| j|j d | j|jd d d S )Nz  good r$   r	   r   )r1   r    r   r   )r   r"   r   r   r   test_good_section_namej   s    
z&SectionNameTest.test_good_section_nameN)r   r   r   r1   r2   r3   r5   r6   r   r   r   r   r-   M   s
   r-   c               @   s:   e Zd ZG dd dZdd Zdd Zdd Zd	d
 ZdS )ModuleNameTestc               @   s2   e Zd ZejjZdZe Zi Z	dd Z
dd ZdS )zModuleNameTest.Dummy_ModuleNamer   c             C   s   | j j| d| jd< d S )Nr   r	   )r
   r   r   )r   r   r   r   r   r   x   s    z(ModuleNameTest.Dummy_ModuleName.__init__c             C   s   || j d< d S )Nr	   )r   )r   r   r   r   r   r   {   s    z)ModuleNameTest.Dummy_ModuleName.showerrorN)r   r   r   r   
ModuleNamer   text0r   r
   r   r   r   r   r   r   r   Dummy_ModuleNames   s   r:   c             C   s0   | j d}| j|j d  | jd|jd  d S )Nr   zno namer	   )r:   r    r   r!   r   )r   r"   r   r   r   test_blank_module_name~   s    
z%ModuleNameTest.test_blank_module_namec             C   s0   | j d}| j|j d  | jd|jd  d S )NZ __name_xyz123_should_not_exist__z	not foundr	   )r:   r    r   r!   r   )r   r"   r   r   r   test_bogus_module_name   s    
z%ModuleNameTest.test_bogus_module_namec             C   s0   | j d}| j|j d  | jd|jd  d S )N	itertoolszsource-basedr	   )r:   r    r   r!   r   )r   r"   r   r   r   test_c_source_name   s    
z!ModuleNameTest.test_c_source_namec             C   s4   | j d}| j|j jd | j|jd d d S )Nidlelibz__init__.pyr	   r   )r:   r(   r   endswithr    r   )r   r"   r   r   r   test_good_module_name   s    
z$ModuleNameTest.test_good_module_nameN)r   r   r   r:   r;   r<   r>   rA   r   r   r   r   r7   p   s
   r7   c               @   s"   e Zd ZG dd dZdd ZdS )HelpsourceBrowsefileTestc               @   s   e Zd ZejjZe ZdS )z)HelpsourceBrowsefileTest.Dummy_HelpSourceN)r   r   r   r   
HelpSourcebrowse_filer   pathvarr   r   r   r   Dummy_HelpSource   s   rF   c             C   s   | j  }xddd dfddd tfddd dfddd tffD ]J\}}}| j 2 |jj| ||_|j  | j|jj | W d Q R X q>W d S )Nr   c             S   s   dS )Nr   r   )abcr   r   r   <lambda>   s    zBHelpsourceBrowsefileTest.test_file_replaces_path.<locals>.<lambda>c             S   s   t S )N)__file__)rG   rH   rI   r   r   r   rJ      s    Zhtestc             S   s   dS )Nr   r   )rG   rH   rI   r   r   r   rJ      s    c             S   s   t S )N)rK   )rG   rH   rI   r   r   r   rJ      s    )	rF   rK   subTestrE   r   ZaskfilenamerD   r    get)r   r"   pathfuncr   r   r   r   test_file_replaces_path   s    
z0HelpsourceBrowsefileTest.test_file_replaces_pathN)r   r   r   rF   rP   r   r   r   r   rB      s   rB   c               @   sF   e Zd ZG dd dZedd Zdd Zdd Zd	d
 Zdd Z	dS )HelpsourcePathokTestc               @   s0   e Zd ZejjZe Zi Zdd Z	dddZ
dS )z%HelpsourcePathokTest.Dummy_HelpSourcec             C   s   | j j| d| jd< d S )Nr   r	   )rN   r   
path_error)r   Z
dummy_pathr   r   r   r      s    z.HelpsourcePathokTest.Dummy_HelpSource.__init__Nc             C   s   || j d< d S )Nr	   )rR   )r   r   Zwidgetr   r   r   r      s    z/HelpsourcePathokTest.Dummy_HelpSource.showerror)N)r   r   r   r   rC   path_okr   rN   rR   r   r   r   r   r   r   rF      s
   rF   c             C   s
   t t_d S )N)orig_platformr   platform)clsr   r   r   tearDownClass   s    z"HelpsourcePathokTest.tearDownClassc             C   s0   | j d}| j|j d  | jd|jd  d S )Nr   zno help filer	   )rF   r    rS   r!   rR   )r   r"   r   r   r   test_path_ok_blank   s    
z'HelpsourcePathokTest.test_path_ok_blankc             C   s4   | j td }| j|j d  | jd|jd  d S )Nzbad-bad-badz	not existr	   )rF   rK   r    rS   r!   rR   )r   r"   r   r   r   test_path_ok_bad   s    z%HelpsourcePathokTest.test_path_ok_badc             C   sd   | j d}| j}xNdD ]F}| j 4 |jj| | j|j | | j|jd d W d Q R X qW d S )Nr   
www.py.orghttp://py.orgr	   )rZ   r[   )rF   r    rL   rN   r   rS   rR   )r   r"   r%   Zurlr   r   r   test_path_ok_web   s    


z%HelpsourcePathokTest.test_path_ok_webc             C   sl   | j d}x\dD ]T\}}| j > |t_|jjt | j|j |t  | j|j	d d W d Q R X qW d S )	Nr   darwinfile://otherr	   r]   r^   r_   r   )r`   ra   )
rF   rL   r   rU   rN   r   rK   r    rS   rR   )r   r"   rU   prefixr   r   r   test_path_ok_file   s    

z&HelpsourcePathokTest.test_path_ok_fileN)
r   r   r   rF   classmethodrW   rX   rY   r\   rc   r   r   r   r   rQ      s   
	rQ   c               @   s"   e Zd ZG dd dZdd ZdS )HelpsourceEntryokTestc               @   s,   e Zd ZejjZi Zi Zdd Zdd Z	dS )z&HelpsourceEntryokTest.Dummy_HelpSourcec             C   s   | j S )N)name)r   r   r   r   item_ok   s    z.HelpsourceEntryokTest.Dummy_HelpSource.item_okc             C   s   | j S )N)rN   )r   r   r   r   rS      s    z.HelpsourceEntryokTest.Dummy_HelpSource.path_okN)
r   r   r   r   rC   r   r   rR   rg   rS   r   r   r   r   rF      s
   rF   c             C   sR   | j  }xDdD ]<\}}}| j $ || |_|_| j|j | W d Q R X qW d S )	Ndoc.txtdocNNNNrh   Nri   NNri   rh   ri   rh   rm   )rj   rk   rl   rn   )rF   rL   rf   rN   r    r   )r   r"   rf   rN   r   r   r   r   test_entry_ok_helpsource   s      
z.HelpsourceEntryokTest.test_entry_ok_helpsourceN)r   r   r   rF   ro   r   r   r   r   re      s   	re   c               @   sD   e Zd Zedd Zedd Zdd Zdd Zd	d
 Zdd Z	dS )QueryGuiTestc             C   sB   t d t  | _}| jj  tj|dddd| _tj | j_	d S )NguiZTESTZtestT)_utest)
r   r   rootwithdrawr   r   r"   r   r'   r   )rV   rs   r   r   r   
setUpClass   s
    
zQueryGuiTest.setUpClassc             C   s   | j `| ` | jj  | `d S )N)r"   r   rs   )rV   r   r   r   rW     s    
zQueryGuiTest.tearDownClassc             C   s(   | j jjdd d | j _| j jj  d S )Nr   end)r"   r
   deleter   r   Z
reset_mock)r   r   r   r   setUp  s    zQueryGuiTest.setUpc             C   s>   | j }|jjdd |jj  | j|jd | j|jj	 d S )Nr   abc)
r"   r
   insert	button_okinvoker    r   r(   r   r)   )r   r"   r   r   r   test_click_ok  s
    
zQueryGuiTest.test_click_okc             C   s0   | j }|jj  | j|jd  | j|jj d S )N)r"   r{   r|   r    r   ZassertFalser   r)   )r   r"   r   r   r   test_click_blank  s    
zQueryGuiTest.test_click_blankc             C   s>   | j }|jjdd |jj  | j|jd  | j|jj	 d S )Nr   ry   )
r"   r
   rz   Zbutton_cancelr|   r    r   r(   r   r)   )r   r"   r   r   r   test_click_cancel  s
    
zQueryGuiTest.test_click_cancelN)
r   r   r   rd   ru   rW   rx   r}   r~   r   r   r   r   r   rp      s   rp   c               @   s    e Zd Zedd Zdd ZdS )SectionnameGuiTestc             C   s   t d d S )Nrq   )r   )rV   r   r   r   ru   $  s    zSectionnameGuiTest.setUpClassc             C   sp   t  }|j  tj|dddhdd}| j}| j|jdh |jjdd |jj	  | j|j
d ~|j  ~d S )NTtry   T)rr   r   Zokay)r   rt   r   r/   r    r0   r
   rz   r{   r|   r   r   )r   rs   r"   r%   r   r   r   test_click_section_name(  s    
z*SectionnameGuiTest.test_click_section_nameN)r   r   r   rd   ru   r   r   r   r   r   r   "  s   r   c               @   s    e Zd Zedd Zdd ZdS )ModulenameGuiTestc             C   s   t d d S )Nrq   )r   )rV   r   r   r   ru   8  s    zModulenameGuiTest.setUpClassc             C   sn   t  }|j  tj|ddddd}| j|jd | j|jj d |jj	  | j
|jjd ~|j  ~d S )Nr   r   r?   T)rr   z__init__.py)r   rt   r   r8   r    r9   r
   rM   r{   r|   r(   r   r@   r   )r   rs   r"   r   r   r   test_click_module_name<  s    
z(ModulenameGuiTest.test_click_module_nameN)r   r   r   rd   ru   r   r   r   r   r   r   6  s   r   c               @   s    e Zd Zedd Zdd ZdS )HelpsourceGuiTestc             C   s   t d d S )Nrq   )r   )rV   r   r   r   ru   K  s    zHelpsourceGuiTest.setUpClassc             C   s   t  }|j  tj|ddtdd}| j}||jj d ||jj t |j	j
  tjdkr`dnd}||jd|t f ~|j  ~d S )Nr   Z__test__T)Zmenuitemfilepathrr   r]   zfile://r   )r   rt   r   rC   rK   r    r
   rM   rN   r{   r|   sysrU   r   r   )r   rs   r"   r%   rb   r   r   r   test_click_help_sourceO  s    


z(HelpsourceGuiTest.test_click_help_sourceN)r   r   r   rd   ru   r   r   r   r   r   r   I  s   r   __main__   F)	verbosityexit)r?   r   ZunittestZtest.supportr   Ztkinterr   r   r   Zidlelib.idle_test.mock_tkr   ZTestCaser   r-   r7   rU   rT   rB   rQ   re   rp   r   r   r   r   mainr   r   r   r   <module>   s&   5#%.+
