• File: test_textview.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_textview.cpython-37.opt-1.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 8.92 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Nj@sdZddlmZddlmZedddlZddlZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZdd	lmZd
dZdd
ZGdddejZGdddejZGdddejZGdddejZGdddejZGdddejZGdddejZedkrej dddS)aTest textview, coverage 100%.

Since all methods and functions create (or destroy) a ViewWindow, which
is a widget containing a widget, etcetera, all tests must be gui tests.
Using mock Text would not change this.  Other mocks are used to retrieve
information about calls.
)textview)requiresZguiN)TkTclErrorCHARNONEWORD)Button)Func)	Mbox_funccCstatdS)N)rrootwithdrawrrD/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_textview.pysetUpModulesrcCsttbdS)N)rupdate_idletasksdestroyrrrrtearDownModulesrc@seZdZeZeZeZdS)VWN)__name__
__module____qualname__r
	transientgrab_setwait_windowrrrrr#src@s,eZdZddZddZddZddZd	S)
ViewWindowTestcCs"tjtjtjdS)N)rr__init__rr)selfrrrsetUp,s

zViewWindowTest.setUpcCsBttdd}|tjj|tjj|tjj|dS)NTitlez	test text)rr
assertTruercalledrrok)rviewrrrtest_init_modal1s
zViewWindowTest.test_init_modalcCsFttdddd}|tjj|tjj|tjj|dS)Nrz	test textF)modal)rrZassertFalserr!rrr")rr#rrrtest_init_nonmodal8s
z!ViewWindowTest.test_init_nonmodalcCs>ttdddd}t|_|||jj|`|dS)Nrz	test textF)r%)rrr
rr"r r!)rr#rrrtest_ok?szViewWindowTest.test_okN)rrrrr$r&r'rrrrr*src@seZdZddZdS)AutoHideScrollbarTestcCs*tt}|t|j|t|jdS)N)tvZAutoHideScrollbarrZassertRaisesrZpackZplace)rZscrollrrrtest_forbidden_geometryJs
z-AutoHideScrollbarTest.test_forbidden_geometryN)rrrr*rrrrr(Hsr(c@s@eZdZeddZeddZefddZddZd	d
Z	dS)ScrollableTextFrameTestcCst|_}|dS)N)rrr
)clsrrrr
setUpClassRsz"ScrollableTextFrameTest.setUpClasscCs|j|j|`dS)N)rrr)r,rrr
tearDownClassWs

z%ScrollableTextFrameTest.tearDownClasscs2tj|jfd|i|fdd}||S)NwrapcsdS)N)rrr)framerr
cleanup_frame_sz9ScrollableTextFrameTest.make_frame.<locals>.cleanup_frame)r)ZScrollableTextFramer
addCleanup)rr/kwargsr1r)r0r
make_frame]s
z"ScrollableTextFrameTest.make_framecCs0|}|jdd||jddddS)Nz1.0z	test textz1.end)r4textinsertassertEqualget)rr0rrr
test_line1esz"ScrollableTextFrameTest.test_line1c
Cs|jtd}||jdt||jxTttgD]H}|j	|d2|j|d}||jd||
|jWdQRXq6WdS)N)r/r/)r4rr7r5cgetZassertIsNotNoneZxscrollrrZsubTestassertIsNone)rr0r/rrrtest_horiz_scrollbarjsz,ScrollableTextFrameTest.test_horiz_scrollbarN)
rrrclassmethodr-r.rr4r9r<rrrrr+Ps
r+c@s,eZdZeddZeddZddZdS)
ViewFrameTestcCs&t|_}|t|d|_dS)Nz	test text)rrr
r)	ViewFramer0)r,rrrrr-~szViewFrameTest.setUpClasscCs |`|j|j|`dS)N)r0rrr)r,rrrr.s

zViewFrameTest.tearDownClasscCs |jjj}||ddddS)Nz1.0z1.endz	test text)r0r5r8r7)rr8rrrr9s
zViewFrameTest.test_line1N)rrrr=r-r.r9rrrrr>|sr>c@sLeZdZeddZeddZddZddZd	d
ZddZ	d
dZ
dS)ViewFunctionTestcCstj|_tt_dS)N)r)	showerror
orig_errorr)r,rrrr-szViewFunctionTest.setUpClasscCs|jt_|`dS)N)rBr)rA)r,rrrr.szViewFunctionTest.tearDownClasscCs>tjtdddd}||tj||jtj|jdS)Nrz	test textF)r%)r)	view_textrassertIsInstance
ViewWindow	viewframer?r")rr#rrrtest_view_textszViewFunctionTest.test_view_textcCs\tjtdtddd}||tj||jtj|jjj	j
}|d|dd|dS)NrasciiF)r%ZTestz1.0z1.end)
r)	view_filer__file__rDrErFr?	textframer5r8ZassertInr")rr#r8rrrtest_view_fileszViewFunctionTest.test_view_filecCs2tjtddddd}|||tjjddS)Nrzabc.xyzrHF)r%zFile Load Error)r)rIrr;r7rAtitle)rr#rrr
test_bad_files
zViewFunctionTest.test_bad_filecCsRtj}|||tdd}tjtd|ddd}|	||
tjjddS)Nz..zCREDITS.txtrrHF)r%zUnicode Decode Error)
ospathabspathjoindirnamerJr)rIrr;r7rArM)rpfnr#rrrtest_bad_encodings

z"ViewFunctionTest.test_bad_encodingcCs4tjtddddd}|jjj}||dddS)NrZtestFZnone)r%r/r/)r)rCrrFrKr5r7r:)rr#Ztext_widgetrrrtest_nowraps
zViewFunctionTest.test_nowrapN)rrrr=r-r.rGrLrNrVrWrrrrr@sr@c@s,eZdZddZddZddZddZd	S)
ButtonClickTestcCsd|_d|_dS)NF)r#r!)rrrrrszButtonClickTest.setUpcCs|jr|jdS)N)r#r)rrrrtearDownszButtonClickTest.tearDowncsnfdd}ttd|d}||jjdjdjj	j
jddd	dS)
Ncsd_tjtdddd_dS)NT
TITLE_TEXTCOMMAND)_utest)r!r)rCrr#r)rrr_commandszAButtonClickTest.test_view_text_bind_with_button.<locals>._commandBUTTON)r5commandTrZz1.0z1.endr[)
r	rinvoker2rr7r!r#rMrFrKr5r8)rr]buttonr)rrtest_view_text_bind_with_buttonsz/ButtonClickTest.test_view_text_bind_with_buttonc	sfdd}ttd|d}||jjdjdjj	j
jj}t
tB}|dd|||d	d
|WdQRXdS)Ncs d_tjtdtddd_dS)NT
TITLE_FILErH)encodingr\)r!r)rIrrJr#r)rrrr]s
zAButtonClickTest.test_view_file_bind_with_button.<locals>._commandr^)r5r_Trcz1.0z1.endz3.0z3.end)r	rr`r2rr7r!r#rMrFrKr5r8openrJreadlinestrip)rr]rar8fr)rrtest_view_file_bind_with_buttons
z/ButtonClickTest.test_view_file_bind_with_buttonN)rrrrrYrbrirrrrrXs
rX__main__)	verbosity)!__doc__Zidlelibrr)Ztest.supportrrOZunittestZtkinterrrrrrZtkinter.ttkr	Zidlelib.idle_test.mock_idler
Zidlelib.idle_test.mock_tkrrrrErZTestCaserr(r+r>r@rXrmainrrrr<module>s(,.)