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

YI~d>@sddlmZddlZddlZddlmZddlmZmZm	Z	m
Z
mZddlmZddl
Z
ddlmZejjZededededdZd	ZGd
ddZGdd
d
ejZGdddejZedkrejdddS))codecontextN)requires)NSEWTkFrameTextTclError)mock)config)mainZ	highlightkeys
extensionsz
class C1():
    # Class comment.
    def __init__(self, a, b):
        self.a = a
        self.b = b
    def compare(self):
        if a > b:
            return a
        elif a < b:
            return b
        else:
            return None
c@s$eZdZddZddZddZdS)DummyEditwincCs"||_||_||_||_d|_dS)Nr)roottopZ
text_frametextlabel)selfrframerrG/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_codecontext.py__init__'s
zDummyEditwin.__init__cCstt|j|S)N)intfloatrindex)rrrrr	getlineno.szDummyEditwin.getlinenocKs|d|_dS)Nr)r)rkwargsrrrupdate_menu_label1szDummyEditwin.update_menu_labelN)__name__
__module____qualname__rrrrrrrr&src@seZdZeddZeddZddZddZd	d
ZddZ	d
dZ
ddZddZddZ
ddZddZejejdddZddZddZd S)!CodeContextTestcCs~tdt}|_|t|}|_t|}|_|dt	|j
dddd|jddtdt
||||_ttj_dS)NZguiz1.0leftZboth)Zsidefillexpand)rowcolumnZsticky)rrrZwithdrawrrrrinsertcode_samplepackZgridrreditortestcfgridleConfuserCfg)clsrrrrrr
setUpClass7szCodeContextTest.setUpClasscCs@ttj_|jjdd|`|`|`|j	|j
|`dS)Nz1.0end)usercfgrr.r/r,rdeleterrZupdate_idletasksdestroy)r0rrr
tearDownClassEs

zCodeContextTest.tearDownClasscsjddjd<tj_ddd_tjjfdd}t	j
jtjd	|}|
|jd_fd
d}t	j
jtjd|}|
|jdS)
NrZTkFixedFontfontz#abcdefz#123456)
background
foregroundcs|dkrjS||S)Ncontext)
highlight_cfg)ZthemeZelement)orig_idleConf_GetHighlightrrrmock_idleconf_GetHighlightVsz9CodeContextTest.setUp.<locals>.mock_idleconf_GetHighlightGetHighlightcsjS)N)
font_override)rZ
configTypesection)rrrmock_idleconf_GetFont`sz4CodeContextTest.setUp.<locals>.mock_idleconf_GetFontZGetFont)ryviewrCodeContextr,ccr;r.r>unittestr	patchobjectstartZ
addCleanupstopr?)rr=ZGetHighlight_patcherrAZGetFont_patcherr)r<rrsetUpNs"

zCodeContextTest.setUpcCs,|jjr|jj|j|j`|`dS)N)rDr:r5__del__)rrrrtearDowngs
zCodeContextTest.tearDowncCsz|j}|j}|j}||j|||j|j||jd|jd||j||jdg||jd||jj	dS)Nr7)rrFr$)
assertEqualr,rDeditwinrassertIsNoner:info
topvisiblet1)reqZedrDrrr	test_initnszCodeContextTest.test_initcCs|jdS)N)rDrK)rrrrtest_del{szCodeContextTest.test_delc	Csb|jddd}|j_|j|t}|jj	dd|WdQRX|
dt|jdS)Ni'cSsdS)Nrrrrr<lambda>z5CodeContextTest.test_del_with_timer.<locals>.<lambda>afterrQz
doesn't exist)
rrYrDrSrKassertRaisesrrtkcallZassertInstrZ	exception)rtimercmrrrtest_del_with_timer~s

z#CodeContextTest.test_del_with_timercCstj||jjddS)N)rrCreloadrNrD
context_depth)rrrrtest_reloads
zCodeContextTest.test_reloadcCsJ|j}|j}|j}|jr||||j||jd|jd||jd|jd||jd|jd||jddd||jj	d	||j
jd
d|jj
dd
|||j||jj	d||jj
ddd|ddD}|jd|||jdd|||||jdd|dS)Nr7Zfgr9bgr8z1.0zend-1crzHide Code ContextrYrQr$r^zShow Code Context
css|]}|dVqdS)Nr).0xrrr	<genexpr>szACodeContextTest.test_toggle_code_context_event.<locals>.<genexpr>r)rNrDtoggle_code_context_eventr:ZassertIsNotNonerr;getrOrrr[r\rSrPjoinget_contextrB)rrTrDZtoggleZline11_contextrrrtest_toggle_code_context_events0 z.CodeContextTest.test_toggle_code_context_eventc	Cs.|j}|jj}|t|dddWdQRX||ddgdf||ddgdf||dddgdf||d	dd
dgdf||ddd
dd
gdf||ddddd
dd
gdf||dddd
dd
gdf||ddddd
gdf||dddd
dd
gdf||ddddd
gdfdS)Nr$r)Zstopline)rgrzclass C1():class)rsrsz    def __init__(self, a, b):def
)rsz    def compare(self):ru)rxz        if a > b:ifrk)rvrxz        elif a < b:elifrgrx)Z
stopindent)rNrDrorZAssertionError)rrTZgcrrrtest_get_contexts:


z CodeContextTest.test_get_contextcCs*|j}|j}|js|||||jdg||jd|j	d|||jdg||jd||j
ddd|j	d|||jddg||jd||j
ddd	|j	d|||jddg||jd
||j
ddd	|j	d
|||jdddg||jd||j
ddd
|j	d|||jdddddg||jd||j
ddd|d|_||jdddddg||jd||j
ddd|j	d|||jdddg||jd||j
ddddS)N)rrMrFr$rgz1.0zend-1cr)rgrzclass C1():rrrqzclass C1():rs)rsrsz    def __init__(self, a, b):rurtz)class C1():
    def __init__(self, a, b):rk)rwrsz    def compare(self):ru)rxrxz        if a > b:ry)rvrxz        elif a < b:rzzHclass C1():
    def compare(self):
        if a > b:
        elif a < b:z    def __init__(self, a, b):)rNrDr:rlrPupdate_code_contextrQrRrrBrmrc)rrTrDrrrtest_update_code_contextslz(CodeContextTest.test_update_code_contextcCs.|j}|j}|j}|js ||jd|||jd|j	dd|||jd|jd|||jd|j	dd|||jd	d|_
|jd|||jd|j	dd
|||jd	|jd||jdd
d|j	dd
|||jd
dS)Nz2.0rgr)z1.5r$z12.0r}z3.0rxz1.0z5.0Zselrt)rNrDZ
jumptoliner:rlrrBrrRZmark_setrcZtag_add)rrTrDZjumprrrtest_jumptoline.s<zCodeContextTest.test_jumptolinercCsD|jjr|j|j||j|j|dS)N)rDr:rlZtimer_eventZassert_not_calledZ
assert_called)rZmock_updaterrrtest_timer_eventWs



z CodeContextTest.test_timer_eventcCs|j}|j}|jd}d}||||jdk	r8|||_||||jd|||_|||jd|dS)Nr7Z
TkTextFont)rNrDrZassertNotEqualr:rlr?Zupdate_font)rrTrDZ	orig_font	test_fontrrrrds

zCodeContextTest.test_fontcs|j|jt|j}ddd}fdd}jr<||_||||||_||dS)Nz#222222z#ffff00)r8r9cs,jd|djd|ddS)Nr8r9)r:)Zcolors)rDrTrrassert_colors_are_equalszFCodeContextTest.test_highlight_colors.<locals>.assert_colors_are_equal)rNrDdictr;r:rlZupdate_highlight_colors)rZorig_colorsZtest_colorsrr)rDrTrtest_highlight_colors}s 

z%CodeContextTest.test_highlight_colorsN)rr r!classmethodr1r6rJrLrUrVr`rdrpr|rrr	rFrGrrCrrrrrrrr"5s	
$0Q)
r"c@seZdZddZddZdS)HelperFunctionTextcCsJtj}d}x |D]\}}||||qW||dtddddS)N))z    first word)z    first)z	first word)	r)u
  ᧔᧒: )z  u᧔᧒)z	no spaces)rno)r)rr)z# TEST COMMENT)rr)z    (continuation))z    rz    (continuation)z^(\s*)([^\s]*))c)z    z(continuation))rZget_spaces_firstwordrNrecompile)rrmZ
test_lineslineZexpected_outputrrrtest_get_spaces_firstwordsz,HelperFunctionText.test_get_spaces_firstwordcCs|j}tj}t}|||dtjddf|||dd|||dtjddf|||dd	|||d
d||dd
dS)NrrFr$)rzclass C1():rrrgz    # Class comment.rq)rsz    def __init__(self, a, b):rurw)rxz        if a > b:ryz	if a == b:)r$z	if a == b:ry)rNrZ
get_line_infor*
splitlinesZINFINITY)rrTZglilinesrrrtest_get_line_infosz%HelperFunctionText.test_get_line_infoN)rr r!rrrrrrrsr__main__rg)	verbosity)ZidlelibrrEZ
unittest.mockZtest.supportrZtkinterrrrrrr	rr
r.r/r3ZIdleUserConfParserr-r*rZTestCaser"rrrrrrr<module>s(k(