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

Nj@sdZddlmZddlZddlmZddlmZmZddl	m
Z
ddlmZddlm
Z
Gd	d
d
ejZGdddejZed
krejdddS)zTest outwin, coverage 76%.)outwinN)requires)TkText)	Mbox_func)Func)mockc@s\eZdZeddZeddZddZddZd	d
ZddZ	d
dZ
ddZddZdS)OutputWindowTestcCsFtdt}|_|tddd|}|_t||_|_dS)NZgui)	rrrootZwithdrawrZOutputWindowwindowrtext)clsr
wrB/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_outwin.py
setUpClasss
zOutputWindowTest.setUpClasscCs$|j|`|`|j|`dS)N)rcloserr
Zdestroy)r
rrr
tearDownClasss

zOutputWindowTest.tearDownClasscCs|jdddS)Nz1.0end)rdelete)selfrrrsetUpszOutputWindowTest.setUpcCs*|j}||d||tdS)Nztest.txt)rZassertFalseZispythonsource__file__)rrrrrtest_ispythonsource sz$OutputWindowTest.test_ispythonsourcecCs||jjddS)NZOutput)assertEqualrtoptitle)rrrrtest_window_title&sz"OutputWindowTest.test_window_titlecCsd|j}|j}t|_d|j_||d||jjdd|j_||d||jjd|`dS)NFZnoTZyes)rrrZ	get_savedresultZ	maybesavecalled)rreqrrrtest_maybesave)szOutputWindowTest.test_maybesavecCs|j}|jj}|jj}|jj}d}|||t|||dd||ddd}|||t|||ddd||ddd|ddd}|||t|||ddd||ddd	|ddd
}|||t|||ddd||ddd
||ddd
|ddd}d}|||ddt||||ddt|||dd|||dd|||dd|d||dd|ddS)NsTest bytes.z1.0z1.endrz	test textzinsert linestartzinsert lineendz
test text
ztest text
Line 2z2.0z2.endzLine 2zLine 2
Zmytag)ZtagsZ	secondtagzmytag.firstz
mytag.lastzsecondtag.firstzsecondtag.last
)	rrrgetrwritelendecoderstrip)rr"rr&r'bZ	test_textZ
test_text2rrr
test_write7s@



zOutputWindowTest.test_writecCsb|j}|jj}|jj}|d||ddd||ddd||dd	d
||ddd
dS)N)zLine 1
zLine 2
zLine 3
z1.0z1.endzLine 1z2.0z2.endzLine 2z3.0z3.endzLine 3zinsert linestartzinsert lineendr$)rrr&r
writelines)rr"r&r-rrrtest_writelinescsz OutputWindowTest.test_writelinescCs
|j}|j}|j}t|_t}|j_t}|_	|
d||||j
d||jd|
ttd|
ttd||||jttdf|dd|
ttd|
d||||jttd	f|j`|`	dS)
NzNot a file linerzNo special linez: 42: spam
z
: 21: spamz1.0r*)rrrrZMockZflistrZgotofileliner	showerrorr'ZassertIsNoneZgoto_file_liner!rstrrargsr)rr"rrZgflr1rrrtest_goto_file_linens(


z$OutputWindowTest.test_goto_file_lineN)
__name__
__module____qualname__classmethodrrrrrr#r,r.r4rrrrr	s,r	c@s2eZdZeddZddZedddZdS)	ModuleFunctionTestcCs
dt_dS)N)rfile_line_progs)r
rrrrszModuleFunctionTest.setUpcCs6tx(ttjtjD]\}}||j|qWdS)N)rZ
compile_progszipZfile_line_patsr:rpattern)rZpatZregexrrrtest_compile_progssz%ModuleFunctionTest.test_compile_progsz
builtins.opencCsDtj}d}x4|D],\}}|||||r||ddqWdS)N))z"foo file "testfile1", line 42, bar)Z	testfile1r0)zfoo testfile2(21) bar)Z	testfile2r/)z  testfile3  : 42: foo bar\n)z
  testfile3  r0)zfoo testfile4.py :1: )zfoo testfile4.py r)utestfile5: ᧔᧒: )Z	testfile5r0)z
testfile6: 42N)ztestfile7 42 textNrr)rZfile_line_helperrZassert_called_with)rZ	mock_openZflhZ
test_lineslineZexpected_outputrrrtest_file_line_helpersz(ModuleFunctionTest.test_file_line_helperN)	r5r6r7r8rr=rZpatchr@rrrrr9sr9__main__r)	verbosity)__doc__ZidlelibrZunittestZtest.supportrZtkinterrrZidlelib.idle_test.mock_tkrZidlelib.idle_test.mock_idlerrZTestCaser	r9r5mainrrrr<module>s