[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.216.11.230: ~ $


��Yf�,�@sdZddlZddlZddlmZmZmZddljZ	ddl
mZddl
mZmZddl
mZdd�Zd	d
�ZGdd�d�ZGd
d�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�Zedkr{ejdddd�dS)z9Test functions and SearchEngine class in SearchEngine.py.�N)�
BooleanVar�	StringVar�TclError)�SearchEngine)�Var�Mbox)�TextcCstt_tt_tt_dS)N)r�serrr�tkMessageBox�rr�H/opt/alt/python35/lib64/python3.5/idlelib/idle_test/test_searchengine.py�setUpModules		r
cCstt_tt_tt_dS)N)rr	rr
rrrr�tearDownModules		rc@seZdZdd�ZdS)�MockcOsdS)Nr)�self�args�kwargsrrr�__init__sz
Mock.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@seZdZdd�ZdS)�GetTestcCs~tj}tt_z[t�}tj|�}|j|tj�|j|j|�|jtj|�|�Wd|t_XdS)N)r	rr�getZassertIsInstanceZassertIsZ
_searchengine)rZsaved_Engine�root�enginerrr�test_get#s			zGetTest.test_getN)rrrrrrrrr!src@seZdZdd�ZdS)�GetLineColTestcCsb|jtjd�d�|jtjd�d	�|jttjd�|jttjd�dS)
Nz1.0�rz1.11�z1.0 lineend�end)rr)rr)�assertEqualr	Zget_line_colZassertRaises�
ValueError)rrrr�test_get_line_col1sz GetLineColTest.test_get_line_colN)rrrr"rrrrr/src@seZdZdd�ZdS)�GetSelectionTestcCsyt�}|jdd�dd�}||_|jtj|�d	�dd�}||_|jtj|�d
�dS)N�1.0zHello World!cSs*|dkrdS|dkr dSt�dS)Nz	sel.firstz1.0zsel.lastz1.12)r)�srrr�selKs
z0GetSelectionTest.test_get_selection.<locals>.sel�1.12cSs|dkrdSt�dS)N�insertz1.5)r)r%rrr�markSsz1GetSelectionTest.test_get_selection.<locals>.mark�1.5)r$r')r*r*)�mockTextr(�indexr r	Z
get_selection)r�textr&r)rrr�test_get_selectionEs			z#GetSelectionTest.test_get_selectionN)rrrr.rrrrr#8s
r#c@seZdZdd�ZdS)�ReverseSearchTestcCs�|j}d}tjd�}|tj||t|��j�d	�|tj||d�j�d
�|tj||d�j�d�|tj||d�j�d�|tj||d�d�dS)
NzHere is an 'is' test text.�is���
���)r1r2)r1r2)r4r5)r4r5)r �re�compiler	Zsearch_reverse�len�span)r�Equal�line�progrrr�test_search_reverse]s	("""z%ReverseSearchTest.test_search_reverseN)rrrr>rrrrr/[sr/c@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�SearchEngineTestcCstjdd�|_dS)Nr)r	rr)rrrr�setUpkszSearchEngineTest.setUpcCsW|j}|j}||j�d�|jd�||j�d�||j�d�|jjd�||j�d�||j�d�|jjd�||j�d�||j	�d�|j
jd�||j	�d�||j�d�|jjd�||j�d�||j
�d�|jjd�||j
�d�dS)N��helloFrTr)rr �getpat�setpatZisre�revar�setZiscase�casevarZisword�wordvarZiswrap�wrapvarZisback�backvar)rrr;rrr�test_is_getps(		
zSearchEngineTest.test_is_getcCsc|j}|jd�|j|j�d�|jjd�|jd�|j|j�d�dS)Nz\srz\\s)rZsetcookedpatr rCrErF)rrrrr�test_setcookedpat�s	

z"SearchEngineTest.test_setcookedpatcCs�|j}|j}||j�d�|jd�||j�d�|jjd�||j�d�|jjd�|jd�||j�d�|jjd�||j�d�dS)NrArBTz	\bhello\bFz\sz\\s)rr ZgetcookedpatrDrHrFrE)rrr;rrr�test_getcookedpat�s		

z"SearchEngineTest.test_getcookedpatcCs�|j}|j}|jd�|j�}||jtjdtj�j�|jj	d�|j�}||jtjd�jd�|jd�||j�d�|jd�|j
j	d�||j�d�|jtjj
d�dS)NZHellorrrA�+z1Error: nothing to repeat at position 0
Pattern: +)rr rDZgetprog�patternr7r8�
IGNORECASErGrFrEr�	showerror�message)rrr;Ztemppatrrr�test_getprog�s		
"

zSearchEngineTest.test_getprogcCs�tj}|j}d}d}||jj||�d�||jd�d|d}||j|�||jj||d�d�||jd�|d7}||j|�dS)Nz[a-zz$unexpected end of regular expressionzRegular expression errorzError: z
Pattern: [a-zr4z

Offset: 5)rrQr rZreport_error�titlerR)rrQr;�pat�msgZexpected_messagerrr�test_report_error�s		
z"SearchEngineTest.test_report_errorN)	rrrr@rKrLrMrSrWrrrrr?hsr?c@s.eZdZedd��Zdd�ZdS)�
SearchTestcCsqt�|_d}|jjd|�tjd�|_tjd�|_dd�|j_	dd�|j_
dS)Nz&First line
Line with target
Last line
z1.0�targetcWs
d|fS)N�fr)rrrr�<lambda>�sz'SearchTest.setUpClass.<locals>.<lambda>cWs
d|fS)N�br)rrrrr[�s)r+r-r(r7r8rUr	rr�search_forward�search_backward)�cls�	test_textrrr�
setUpClass�szSearchTest.setUpClassc	Cs|j}|j}|j}|j}|j}|jjd�|||�d�dd�}||_||||�d||ddddff�|jjd�||||�d||ddddff�|jjd�|j	jd�||||�d||ddddff�|j	jd�d	d
�}||_||||�d||ddddff�||||d�d||dd
ddff�|j	jd�||||�d||dd
ddff�||||d�d||ddddff�dS)NcSs|dkrdSt�dS)Nr(z1.5)r)r%rrrr)�sz$SearchTest.test_search.<locals>.markrZrr4TFr\cSs*|dkrdS|dkr dSt�dS)Nz	sel.firstz2.10zsel.lastz2.16)r)r%rrrr&�s
z#SearchTest.test_search.<locals>.sel���
)
r rZsearch_textr-rUZpatvarrFr,rIrJ)rr;r�searchr-rUr)r&rrr�test_search�s.						...	.1.zSearchTest.test_searchN)rrr�classmethodrarfrrrrrX�srXc@sFeZdZedd��Zdd�Zdd�Zdd�Zd	S)
�ForwardBackwardTestcCs�tjd�|_t�|_dd�|j_d}|jjd|�tjd�|_	d|_
tjd	�|_tjd
�|_dS)
NcSsdS)Nz4.0r)r,rrrr[sz0ForwardBackwardTest.setUpClass.<locals>.<lambda>z&First line
Line with target
Last line
z1.0rYrbrdrcZxyzz\w*�rdrc)rbri)
r	rrr+r-r,r(r7r8rU�res�failpat�emptypat)r_r`rrrras	zForwardBackwardTest.setUpClasscsd��fdd�}|S)Nrcs@��j|||||�}|r<|d|dj�fS|S)Nrr)r-r:)rUr<�colZwrap�okrj)�funcrrrre sz/ForwardBackwardTest.make_search.<locals>.searchr)rrorer)rorr�make_searchszForwardBackwardTest.make_searchcCs
|j}|j|jj�}|j}|||ddd�|j�|||ddd�|j�|||ddd�d�|||ddd�|j�|||jddd�d�|||jdddd	d�d�|||jddd�|j�dS)NrrT�Frbrd�	rn�rrrr)rbrs)r rprr]rUrjrkrl)rr;ZforwardrUrrr�test_search_forward&s		%z'ForwardBackwardTest.test_search_forwardcCs|j}|j|jj�}|j}|||ddd�|j�|||ddd�|j�|||ddd�d�|||ddd�|j�|||jddd�d�|||jdd	dd
d�d�|||jddd�d�dS)Nrqr4TrbrFrcrrrdrn�rrrr)rbru�r4rr)rbrv)r rprr^rUrjrkrl)rr;ZbackwardrUrrr�test_search_backward7s		%z(ForwardBackwardTest.test_search_backwardN)rrrrgrarprtrwrrrrrhsrh�__main__�	verbosityrb�exit)�__doc__r7ZunittestZtkinterrrrZtkinter.messageboxZ
messageboxr
Zidlelibrr	Zidlelib.idle_test.mock_tkrrrr+r
rrZTestCaserrr#r/r?rXrhr�mainrrrr�<module>s&	#
`=C

Filemanager

Name Type Size Permission Actions
__init__.cpython-35.opt-1.pyc File 823 B 0644
__init__.cpython-35.opt-2.pyc File 496 B 0644
__init__.cpython-35.pyc File 823 B 0644
htest.cpython-35.opt-1.pyc File 11.44 KB 0644
htest.cpython-35.opt-2.pyc File 9.17 KB 0644
htest.cpython-35.pyc File 11.44 KB 0644
mock_idle.cpython-35.opt-1.pyc File 2.4 KB 0644
mock_idle.cpython-35.opt-2.pyc File 1.71 KB 0644
mock_idle.cpython-35.pyc File 2.4 KB 0644
mock_tk.cpython-35.opt-1.pyc File 11.12 KB 0644
mock_tk.cpython-35.opt-2.pyc File 6.29 KB 0644
mock_tk.cpython-35.pyc File 11.12 KB 0644
test_autocomplete.cpython-35.opt-1.pyc File 4.95 KB 0644
test_autocomplete.cpython-35.opt-2.pyc File 4.93 KB 0644
test_autocomplete.cpython-35.pyc File 4.95 KB 0644
test_autoexpand.cpython-35.opt-1.pyc File 4.13 KB 0644
test_autoexpand.cpython-35.opt-2.pyc File 4.06 KB 0644
test_autoexpand.cpython-35.pyc File 4.13 KB 0644
test_calltips.cpython-35.opt-1.pyc File 10.01 KB 0644
test_calltips.cpython-35.opt-2.pyc File 9.88 KB 0644
test_calltips.cpython-35.pyc File 10.09 KB 0644
test_config_help.cpython-35.opt-1.pyc File 4.31 KB 0644
test_config_help.cpython-35.opt-2.pyc File 4.23 KB 0644
test_config_help.cpython-35.pyc File 4.31 KB 0644
test_config_name.cpython-35.opt-1.pyc File 3.16 KB 0644
test_config_name.cpython-35.opt-2.pyc File 3.08 KB 0644
test_config_name.cpython-35.pyc File 3.16 KB 0644
test_configdialog.cpython-35.opt-1.pyc File 1.43 KB 0644
test_configdialog.cpython-35.opt-2.pyc File 1.27 KB 0644
test_configdialog.cpython-35.pyc File 1.43 KB 0644
test_delegator.cpython-35.opt-1.pyc File 1.1 KB 0644
test_delegator.cpython-35.opt-2.pyc File 1.09 KB 0644
test_delegator.cpython-35.pyc File 1.1 KB 0644
test_editmenu.cpython-35.opt-1.pyc File 2.88 KB 0644
test_editmenu.cpython-35.opt-2.pyc File 2.48 KB 0644
test_editmenu.cpython-35.pyc File 2.88 KB 0644
test_editor.cpython-35.opt-1.pyc File 1.19 KB 0644
test_editor.cpython-35.opt-2.pyc File 1.17 KB 0644
test_editor.cpython-35.pyc File 1.19 KB 0644
test_formatparagraph.cpython-35.opt-1.pyc File 12.41 KB 0644
test_formatparagraph.cpython-35.opt-2.pyc File 11.65 KB 0644
test_formatparagraph.cpython-35.pyc File 12.41 KB 0644
test_grep.cpython-35.opt-1.pyc File 3.08 KB 0644
test_grep.cpython-35.opt-2.pyc File 2.54 KB 0644
test_grep.cpython-35.pyc File 3.08 KB 0644
test_help_about.cpython-35.opt-1.pyc File 1.96 KB 0644
test_help_about.cpython-35.opt-2.pyc File 1.82 KB 0644
test_help_about.cpython-35.pyc File 1.96 KB 0644
test_hyperparser.cpython-35.opt-1.pyc File 8 KB 0644
test_hyperparser.cpython-35.opt-2.pyc File 7.81 KB 0644
test_hyperparser.cpython-35.pyc File 8 KB 0644
test_idlehistory.cpython-35.opt-1.pyc File 6.72 KB 0644
test_idlehistory.cpython-35.opt-2.pyc File 6.57 KB 0644
test_idlehistory.cpython-35.pyc File 6.72 KB 0644
test_io.cpython-35.opt-1.pyc File 8.76 KB 0644
test_io.cpython-35.opt-2.pyc File 8.75 KB 0644
test_io.cpython-35.pyc File 8.76 KB 0644
test_parenmatch.cpython-35.opt-1.pyc File 4.06 KB 0644
test_parenmatch.cpython-35.opt-2.pyc File 3.61 KB 0644
test_parenmatch.cpython-35.pyc File 4.06 KB 0644
test_pathbrowser.cpython-35.opt-1.pyc File 1.31 KB 0644
test_pathbrowser.cpython-35.opt-2.pyc File 1.29 KB 0644
test_pathbrowser.cpython-35.pyc File 1.31 KB 0644
test_percolator.cpython-35.opt-1.pyc File 5.18 KB 0644
test_percolator.cpython-35.opt-2.pyc File 5.13 KB 0644
test_percolator.cpython-35.pyc File 5.18 KB 0644
test_replacedialog.cpython-35.opt-1.pyc File 7.5 KB 0644
test_replacedialog.cpython-35.opt-2.pyc File 7.43 KB 0644
test_replacedialog.cpython-35.pyc File 7.5 KB 0644
test_rstrip.cpython-35.opt-1.pyc File 1.55 KB 0644
test_rstrip.cpython-35.opt-2.pyc File 1.54 KB 0644
test_rstrip.cpython-35.pyc File 1.55 KB 0644
test_searchdialog.cpython-35.opt-1.pyc File 2.42 KB 0644
test_searchdialog.cpython-35.opt-2.pyc File 2.34 KB 0644
test_searchdialog.cpython-35.pyc File 2.42 KB 0644
test_searchdialogbase.cpython-35.opt-1.pyc File 5.79 KB 0644
test_searchdialogbase.cpython-35.opt-2.pyc File 5.58 KB 0644
test_searchdialogbase.cpython-35.pyc File 5.79 KB 0644
test_searchengine.cpython-35.opt-1.pyc File 10.7 KB 0644
test_searchengine.cpython-35.opt-2.pyc File 10.61 KB 0644
test_searchengine.cpython-35.pyc File 10.7 KB 0644
test_text.cpython-35.opt-1.pyc File 6.86 KB 0644
test_text.cpython-35.opt-2.pyc File 6.84 KB 0644
test_text.cpython-35.pyc File 6.86 KB 0644
test_textview.cpython-35.opt-1.pyc File 3.86 KB 0644
test_textview.cpython-35.opt-2.pyc File 3.53 KB 0644
test_textview.cpython-35.pyc File 3.86 KB 0644
test_undodelegator.cpython-35.opt-1.pyc File 4.57 KB 0644
test_undodelegator.cpython-35.opt-2.pyc File 4.3 KB 0644
test_undodelegator.cpython-35.pyc File 4.57 KB 0644
test_warning.cpython-35.opt-1.pyc File 2.84 KB 0644
test_warning.cpython-35.opt-2.pyc File 2.5 KB 0644
test_warning.cpython-35.pyc File 2.84 KB 0644
test_widgetredir.cpython-35.opt-1.pyc File 5.49 KB 0644
test_widgetredir.cpython-35.opt-2.pyc File 5.4 KB 0644
test_widgetredir.cpython-35.pyc File 5.49 KB 0644