Your IP : 3.16.66.199


Current Path : /opt/alt/python37/lib64/python3.7/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/idle_test/__pycache__/test_grep.cpython-37.pyc

B

� f��@s�dZddlmZddlZddlmZddlmZddlZddl	Z	Gdd�d�Z
e
�ZGdd	�d	�Ze�Z
Gd
d�dej�ZGdd
�d
ej�ZGdd�dej�Zedkr�ejdd�dS)a  !Changing this line will break Test_findfile.test_found!
Non-gui unit tests for grep.GrepDialog methods.
dummy_command calls grep_it calls findfiles.
An exception raised in one method will fail callers.
Otherwise, tests are mostly independent.
Currently only test grep_it, coverage 51%.
�)�grepN)�captured_stdout)�Varc@seZdZdZdd�ZdS)�Dummy_searchenginez�GrepDialog.__init__ calls parent SearchDiabolBase which attaches the
    passed in SearchEngine instance as attribute 'engine'. Only a few of the
    many possible self.engine.x attributes are needed here.
    cCs|jS)N)�_pat)�self�r�@/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_grep.py�getpatszDummy_searchengine.getpatN)�__name__�
__module__�__qualname__�__doc__r
rrrr	rsrc@s(eZdZejjZed�ZeZ	dd�Z
dS)�
Dummy_grepFcCsdS)Nr)rrrr	�close"szDummy_grep.closeN)rrr
rZ
GrepDialog�grep_itrZrecvar�searchengine�enginerrrrr	rsrc@sDeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�
FindfilesTestcCs"tj�t�|_tj�|j�|_dS)N)�os�path�realpath�__file__�dirname)�clsrrr	�
setUpClass*szFindfilesTest.setUpClasscCs|`|`dS)N)rr)rrrr	�
tearDownClass/szFindfilesTest.tearDownClassc	CsDt��}tt�ddd��}WdQRX|�|g�|�d|���dS)NZ
invaliddirz*.*FZinvalid)r�listr�	findfiles�assertEqual�assertIn�getvalue)r�s�filelistrrr	�test_invaliddir3szFindfilesTest.test_invaliddircCsVtj}t��}t�|j�d}t|tj|d��}|�tj�	tj|�|�t�|�dS)Nztest_grep.pyF)
rrr�getcwd�chdirrr�curdirr �join)r�ffZsave_cwd�filenamer#rrr	�test_curdir9szFindfilesTest.test_curdircCs�tj}tj�|jd�}t||jdd��}|�t|�d�|�|j	|�|�
||�t||jdd��}|�t|�d�|�
|j	|�|�||�t||jdd��}|�t|�d�|�
|j	|�dS)Nz
README.txtz*.pyF�
z*.txtrzgrep.*)
rrrrr(r�
assertGreater�lenr r�assertNotInZassertNotEqualr)rr)Zreadmer#rrr	�	test_baseCszFindfilesTest.test_basecCs�tj}tj�|j�}tj�|d�}d}t|||d��}t|�}|�|d�|�	||�|�
|j|�t|||d��}|�t|�|�|�	||�|�	|j|�tj�|�}t||dd��}|�	|j|�dS)Nzgrep.pyz*.pyF�T)rrrrrr(rr.r-r r/r)rr)�parentZgrepfile�patr#Zparent_sizerrr	�test_recurseYs zFindfilesTest.test_recurseN)
rrr
�classmethodrrr$r+r0r4rrrr	r(s
rc@s$eZdZdd�Zdd�Zdd�ZdS)�Grep_itTestc	CsF|tj_t��}t�t�|�t�WdQRX|���	d�}|�
�|S)N�
)�_greprrrr�re�compilerr!�split�pop)rr3r"�linesrrr	�report{szGrep_itTest.reportcCsBd}|�|�}|�t|�d�|�||d�|�|dd�dS)Nzxyz*xyz*xyz*xyz*xyz*xyz*xyz*�r�zNo hits.)r>rr.r )rr3r=rrr	�test_unfound�s

zGrep_itTest.test_unfoundcCsfd}|�|�}|�t|�d�|�||d�|�d|d�|�d|d�|�|d�d	��dS)
Nz<""" !Changing this line will break Test_findfile.test_found!�rzpy: 1:r@�2��z(Hint:)r>rr.r Z
assertTrue�
startswith)rr3r=rrr	�
test_found�s
zGrep_itTest.test_foundN)rrr
r>rArGrrrr	r6vsr6c@seZdZdS)�Default_commandTestN)rrr
rrrr	rH�srH�__main__r?)�	verbosity)rZidlelibrZunittestZtest.supportrZidlelib.idle_test.mock_tkrrr9rrrr8ZTestCaserr6rHr�mainrrrr	�<module>s
N

?>