• File: test_grep.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/idlelib/idle_test/__pycache__/test_grep.cpython-37.opt-1.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 4.78 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Nj@sdZddlmZddlZddlmZddlmZddlZddl	Z	GdddZ
e
ZGdd	d	ZeZ
Gd
ddejZGdd
d
ejZGdddejZedkrejdddS)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@seZdZdZddZdS)Dummy_searchenginezGrepDialog.__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)selfr@/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_grep.pygetpatszDummy_searchengine.getpatN)__name__
__module____qualname____doc__r
rrrr	rsrc@s(eZdZejjZedZeZ	ddZ
dS)
Dummy_grepFcCsdS)Nr)rrrr	close"szDummy_grep.closeN)rrr
rZ
GrepDialoggrep_itrZrecvarsearchengineenginerrrrr	rsrc@sDeZdZeddZeddZddZddZd	d
ZddZ	d
S)
FindfilesTestcCs"tjt|_tj|j|_dS)N)ospathrealpath__file__dirname)clsrrr	
setUpClass*szFindfilesTest.setUpClasscCs|`|`dS)N)rr)rrrr	
tearDownClass/szFindfilesTest.tearDownClassc	CsDt}ttddd}WdQRX||g|d|dS)NZ
invaliddirz*.*FZinvalid)rlistr	findfilesassertEqualassertIngetvalue)rsfilelistrrr	test_invaliddir3szFindfilesTest.test_invaliddircCsVtj}t}t|jd}t|tj|d}|tj	tj||t|dS)Nztest_grep.pyF)
rrrgetcwdchdirrrcurdirr join)rffZsave_cwdfilenamer#rrr	test_curdir9szFindfilesTest.test_curdircCstj}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
assertGreaterlenr rassertNotInZassertNotEqualr)rr)Zreadmer#rrr		test_baseCszFindfilesTest.test_basecCstj}tj|j}tj|d}d}t|||d}t|}||d|	|||
|j|t|||d}|t|||	|||	|j|tj|}t||dd}|	|j|dS)Nzgrep.pyz*.pyFT)rrrrrr(rr.r-r r/r)rr)parentZgrepfilepatr#Zparent_sizerrr	test_recurseYs zFindfilesTest.test_recurseN)
rrr
classmethodrrr$r+r0r4rrrr	r(s
rc@s$eZdZddZddZddZdS)Grep_itTestc	CsF|tj_t}tt|tWdQRX|	d}|
|S)N
)_greprrrrrecompilerr!splitpop)rr3r"linesrrr	report{szGrep_itTest.reportcCsBd}||}|t|d|||d||dddS)Nzxyz*xyz*xyz*xyz*xyz*xyz*xyz*rzNo hits.)r>rr.r )rr3r=rrr	test_unfounds

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