ÿØÿàJFIFxxÿÛC      ÿÛC  ÿÀ"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑÿØÿàJFIFxxÿÛC      ÿÛC  ÿÀ"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑB „ f©:ã@sdZddlmZddlmZddlZddlmZddlmZddl m Z m Z ddlm Z dd l mZejjZe  d ¡e  d ¡e  d ¡e  d ¡d œZd Zd d„Zdd„ZGdd„dejƒZGdd„dejƒZGdd„dejƒZGdd„dejƒZedkrejdddS)zTest colorizer, coverage 93%.é)Ú colorizer)ÚrequiresN)Úmock)Úpartial)ÚTkÚText)Úconfig)Ú PercolatorÚ)ÚmainÚ highlightÚkeysÚ extensionsa+if True: int ('1') # keyword, builtin, string, comment elif False: print(0) # 'string' in comment else: float(None) # if in comment if iF + If + IF: 'keyword matching must respect case' if'': x or'' # valid string-keyword no-space combinations async def f(): await g() 'x', '''x''', "x", """x""" cCs ttj_dS)N)ÚtestcfgrÚidleConfÚuserCfg©rrúE/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_colorizer.pyÚ setUpModule!srcCs ttj_dS)N)ÚusercfgrrrrrrrÚtearDownModule%src@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) Ú FunctionTestcCs| t dd¡d¡dS)NZtest)ÚaÚbZcdz(?Pa|b|cd))Ú assertEqualrÚany)ÚselfrrrÚtest_any+szFunctionTest.test_anycCs| t ¡¡dS)N)Ú assertTruerZmake_pat)rrrrÚ test_make_pat/szFunctionTest.test_make_patcCs¸tj}|j}d}| |¡}|| ¡ddƒ| || ¡¡}|| ¡ddƒ| || ¡¡}|| ¡ddƒ| || ¡¡}|| ¡dd ƒ| || ¡¡}|| ¡ddƒdS) Nzdef f(): print("hello") ÚKEYWORDÚdefÚSYNCÚ ÚBUILTINÚprintÚSTRINGz"hello")rÚprogrÚsearchÚ groupdictÚend)rr'ÚeqÚlineÚmrrrÚ test_prog3s zFunctionTest.test_progcCs:tj}| d¡}| |¡| d¡}| | d¡d¡dS)NZnospacez spacer)rÚidprogÚmatchÚ assertIsNonerÚgroup)rr/r-rrrÚ test_idprogBs    zFunctionTest.test_idprogN)Ú__name__Ú __module__Ú __qualname__rrr.r3rrrrr)src@s,eZdZedd„ƒZedd„ƒZdd„ZdS)ÚColorConfigTestcCs*tdƒtƒ}|_| ¡t|ƒ|_dS)NÚgui)rrÚrootÚwithdrawrÚtext)Úclsr9rrrÚ setUpClassLs zColorConfigTest.setUpClasscCs |`|j ¡|j ¡|`dS)N)r;r9Úupdate_idletasksÚdestroy)r<rrrÚ tearDownClassSs  zColorConfigTest.tearDownClasscCsn|j}|j}t |¡||ddƒ||ddƒ||ddƒ||ddƒ||dd ƒ||d dƒdS) NÚ backgroundz#ffffffÚ foregroundz#000000ZselectbackgroundZgrayZselectforegroundZinsertbackgroundZblackZinactiveselectbackground)r;rrZ color_config)rr;r+rrrÚtest_color_configZs z!ColorConfigTest.test_color_configN)r4r5r6Ú classmethodr=r@rCrrrrr7Js  r7c@sDeZdZedd„ƒZedd„ƒZdd„Zdd„Zd d „Zd d „Z d S)ÚColorDelegatorInstantiationTestcCs.tdƒtƒ}|_| ¡t|ƒ}|_dS)Nr8)rrr9r:rr;)r<r9r;rrrr=is z*ColorDelegatorInstantiationTest.setUpClasscCs |`|j ¡|j ¡|`dS)N)r;r9r>r?)r<rrrr@ps  z-ColorDelegatorInstantiationTest.tearDownClasscCst ¡|_dS)N)rÚColorDelegatorÚcolor)rrrrÚsetUpwsz%ColorDelegatorInstantiationTest.setUpcCs*|j ¡|j dd¡|j ¡|`dS)Nz1.0r*)rGÚcloser;ÚdeleteÚ resetcache)rrrrÚtearDownzs  z(ColorDelegatorInstantiationTest.tearDowncCs|j}| |tj¡dS)N)rGÚassertIsInstancerrF)rrGrrrÚ test_init€sz)ColorDelegatorInstantiationTest.test_initcCs:|j}| |j¡| |j¡| |j¡| |j¡dS)N)rGr1Úafter_idrÚallow_colorizingÚ assertFalseÚ colorizingÚstop_colorizing)rrGrrrÚtest_init_state„s    z/ColorDelegatorInstantiationTest.test_init_stateN) r4r5r6rDr=r@rHrLrNrTrrrrrEgs   rEc@säeZdZedd„ƒZedd„ƒZdd„Zdd„Zd d „Zd d „Z d d„Z e j   ejd¡dd„ƒZe j   ejd¡dd„ƒZdd„Zdd„Ze j   ejd¡dd„ƒZe j   ejd¡dd„ƒZe j   ejd¡e j   ejd¡dd„ƒƒZd S)!ÚColorDelegatorTestcCs8tdƒtƒ}|_| ¡t|ƒ}|_t|ƒ|_dS)Nr8)rrr9r:rr;r Ú percolator)r<r9r;rrrr=s  zColorDelegatorTest.setUpClasscCs0|jj ¡|`|`|j ¡|j ¡|`dS)N)rVZredirrIr;r9r>r?)r<rrrr@™s    z ColorDelegatorTest.tearDownClasscCst ¡|_|j |j¡dS)N)rrFrGrVZ insertfilter)rrrrrH¡s zColorDelegatorTest.setUpcCs8|j ¡|j |j¡|j dd¡|j ¡|`dS)Nz1.0r*)rGrIrVZ removefilterr;rJrK)rrrrrL¦s   zColorDelegatorTest.tearDowncCs:|j}| |jtj¡| |jj dd|j ¡dd¡dS)NÚafterÚinfoéÚtimer) rGrMÚdelegaterZ Delegatorrr9ÚtkÚcallrO)rrGrrrÚtest_setdelegate­s z#ColorDelegatorTest.test_setdelegatec Cs|ttjjdd}xf|jj ¡D]V\}}|j|d<| d|¡| d|¡|dkrj|  |||  ¡d¡WdQRXqWdS)Nz IDLE Classic)Útheme)ÚtagrArB)r"ÚTODO)Úelement) rrrÚ GetHighlightrGÚtagdefsÚitemsÚsubTestZassertInrÚlower)rr r`ZcolorsrrrÚtest_LoadTagDefsµs  z#ColorDelegatorTest.test_LoadTagDefsc Cs¨|j}ttjjdd}xx|jjD]l}xfdD]^}|j||dF|dkr\| |  ||¡d¡n"| |  ||¡||  ¡d|¡WdQRXq*Wq W| |  ¡dd ¡dS) Nz IDLE Classic)r_)rArB)r`Úplane)r"rar )rbéÿÿÿÿZsel) r;rrrrcrGrdrfrZtag_cgetrgÚ tag_names)rr;r r`rirrrÚtest_config_colors¾s &z%ColorDelegatorTest.test_config_colorsÚ notify_rangecCsb|j}| dd¡| | dd¡d¡| dd¡| dd¡| | dd¡d¡| d d ¡dS) NÚinsertZfooz1.0r*zfoo z1.0+3cZbarbazz foobarbaz z1.3z1.3+6c)r;rnrÚgetÚassert_called_with)rÚ mock_notifyr;rrrÚ test_insertÌs   zColorDelegatorTest.test_insertcCs||j}| dd¡| | dd¡d¡| d¡| | dd¡d¡| d¡| dd ¡| | dd¡d ¡| d¡dS) NrnZ abcdefghiz1.0r*z abcdefghi z1.7z abcdefgi z1.3z1.6zabcgi )r;rnrrorJrp)rrqr;rrrÚ test_deleteØs    zColorDelegatorTest.test_deletecCs|j}|j}|j}|j}||jj dd|¡ddƒ| |j¡| |j ¡|  |j ¡d|_|  dd¡| |j ¡||j|ƒ|  |¡d|_|  dd¡|  |j ¡| |j¡||jj dd|j¡ddƒ| |j|¡|  |j¡d|_d |_ |  d d ¡| |j¡dS) NrWrXrYrZTz1.0r*z1.0+3cFz1.4z1.4+10c)r;rGrrOr9r\r]rQrRrSrrPrmÚ after_cancelZassertIsNotNoneÚassertNotEqualr1)rr;rGr+Zsave_idrrrÚtest_notify_rangeçs0            z$ColorDelegatorTest.test_notify_rangecCsP|j}|j}| |j¡| |j¡| |j¡||jj  dd|j ¡ddƒ|  ¡|  |j ¡| |j¡| |j¡| |j¡d|_|  ¡|  |j ¡| |j¡| |j¡| |j¡|  ¡|  |j ¡| |j¡| |j¡| |j¡d|_|  ¡||jj  dd|j ¡ddƒ| |j¡| |j¡| |j¡dS)NrWrXrYrZTF) rGrrQrRrSrrPr9r\r]rOZtoggle_colorize_eventr1)rrGr+rrrÚtest_toggle_colorize_event s8                 z-ColorDelegatorTest.test_toggle_colorize_eventÚrecolorize_maincCs|j}|j}|j}| |j¡|j}d|_| ¡| ¡||_d|_| ¡| ¡d|_d|_ | ¡| ¡d|_ | ¡|  |j ¡|  |j ¡|  ¡||j dƒ||jj dd|j¡ddƒ| ddd ¡| ¡|  |j ¡|  |j ¡|  ¡||j d ƒ| |j¡dS) NFTrYrWrXrZraz1.0r*é)r;rGrrtrOr[Ú recolorizeZassert_not_calledrPrRrQrSZ assert_calledZ call_countr9r\r]Ú tag_remover1)rZ mock_recmainr;rGr+Z save_delegaterrrÚtest_recolorize3s<       z"ColorDelegatorTest.test_recolorizec Csz|j}|j}|j}| dt¡d}| ddd¡| ¡x8| ¡D],}|j|d||  |¡dƒWdQRXqBW|  ddd¡| ¡x8|D]0\}}|j|d|| |¡|ƒWdQRXqŽW||  dd¡dƒ||  d d¡d ƒ||  d d ¡d ƒ||  dd ¡dƒ||  dd ¡dƒ||  dd¡dƒ||  dd¡dƒ||  dd¡dƒ||  dd¡dƒ||  dd¡dƒdS)Nrn))z1.0)r )z1.2r)z1.3)r )z1.7r)z1.9)r$)z1.14)r&)z1.19)ÚCOMMENT)z2.1)r )z2.18r)z2.25)r})z3.6)r$)z3.12)r )z3.21)r})z4.0)r )z4.3r)z4.6r)z5.2)r&)z5.8)r )z5.10)r&)z6.0)r )z6.10)Z DEFINITION)z6.11r)z7.0)r&)z7.4r)z7.5)r&)z7.12r)z7.14)r&)z1.55)r")z2.50)r")z3.34)r"raz1.0r*)r`r)Úindexr )z1.0z1.2r}z2.0)z2.22z2.43r")z2.43z3.0r&)z4.17z4.53z7.0)z7.0z7.3z7.3)z7.5z7.12z7.12)z7.14z7.17z7.17)z7.19z7.26)z7.26z9.0) r;rGrrnÚsourcer{rxrkrfÚ tag_rangesÚtag_addZ tag_nextrange) rrqr;rGr+Zexpectedr`r~Z expected_tagsrrrÚtest_recolorize_main`s2 z'ColorDelegatorTest.test_recolorize_mainrzc CsÄ|j}|j}| dt¡| ¡| dd¡| dd¡| dd¡x8|jD].}|j|d| |  |¡d¡WdQRXqLW|  ¡x8|jD].}|j|d|  |  |¡d¡WdQRXqŽWdS)NrnZERRORz1.0raZhit)r`r) r;rGrnrrxrrdrfrur€Z removecolorsr)rrqZmock_recolorizer;rGr`rrrÚtest_removecolorss       z$ColorDelegatorTest.test_removecolorsN)r4r5r6rDr=r@rHrLr^rhrlrZpatchÚobjectrrFrrrsrvrwr|r‚rƒrrrrrUŽs   $(-0rUÚ__main__ry)Ú verbosity)Ú__doc__ZidlelibrZ test.supportrZunittestrÚ functoolsrZtkinterrrrZidlelib.percolatorr rrrZIdleUserConfParserrrrrZTestCaserr7rErUr4r rrrrÚs0       !'