3  fg@sndZddlmZddlmZedddlZddlmZddlmZddl m Z m Z m Z m Z mZmZdd lmZdd lmZmZmZejZejd ejd ejd ejd d Zdadaed ZedZedZedZddZddZ Gdddej!Z"Gdddej!Z#Gdddej!Z$Gdddej!Z%Gdddej!Z&Gdd d ej!Z'e(d!krjej)d"d#dS)$zfTest configdialog, coverage 94%. Half the class creates dialog, half works with user customizations. ) configdialog)requiresZguiN)mock)Func)Tk StringVarIntVar BooleanVarDISABLEDNORMAL)config)idleConfchangestracers)main highlightkeys extensionsrrrrcCs tt_tatjtdddadS)NZTestT)Z_utest)testcfgr userCfgrrootrZ ConfigDialogdialogrrH/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_configdialog.py setUpModule!srcCs:tt_tjtjtjtjtj daa dS)N) usercfgr rrdetachclearrrupdate_idletasksZdestroyrrrrrtearDownModule(sr c@sheZdZdZeddZeddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS) FontPageTestzTest that font widgets enable users to make font changes. Test that widget actions set vars, that var changes add three options to changes and call set_samples, and that set_samples changes the font of both sample boxes. cCs,tj}|_tjj|t|_|jdS)N)rfontpagepagenoteselectr set_samplesupdate)clsr#rrr setUpClass:s  zFontPageTest.setUpClasscCs |j`dS)N)r#r&)r(rrr tearDownClassAszFontPageTest.tearDownClasscCs tjdS)N)rr)selfrrrsetUpEszFontPageTest.setUpcCstj|j}|jjd|jjd|jjdd|j_|j |j |jj d|j |jj d|j |jj |j |jjdtjdS)NZFake1Tr)rrr# font_nameset font_size font_boldr&calledZ load_font_cfgassertNotEqualget assertFalse assertEqualattach)r+drrrtest_load_font_cfgHs   zFontPageTest.test_load_font_cfgcCs|j}|jjdkr|jd|j}|jd|jjd}|j|j|jd|jd|jd}|j |||j |j j|j |j|j|jd|jd|jd}|j |||j |j j|j dS) Nzneed at least 2 fontsrZactivez zzz)r#fontlistsizeskipTestactivater5 focus_forcer'event_generater4assertInr/lowerr7)r+r9r<fontZ down_fontZup_fontrrrtest_fontlist_keyXs(           zFontPageTest.test_fontlist_keyc Cs|j}|jjdkr|jd|j}|jd|j|jd|j|jd\}}}}||d7}||d7}|j d||d|j d||d|j d}|j d}|j |||j |j j |jdS) Nr;zneed at least 2 fontsrr.z )xyzanchor)r#r<r=r>r?r@seer'bboxrAr5r7rBr/rC) r+r9r<rFrGdxdyZfont1Z select_fontrrrtest_fontlist_mouseus"        z FontPageTest.test_fontlist_mousecCs*|j}|jjjd|j|jjddS)N(40)r#ZsizelistZvariabler0r7r1r5)r+r9rrr test_sizelistszFontPageTest.test_sizelistcCsJ|j}|jjd|jj|j|jj|jj|j|jjdS)NF)r#r2r0Z bold_toggleinvoke assertTruer5r6)r+r9rrrtest_bold_toggles    zFontPageTest.test_bold_togglecCstjtdd}t|d}|ddk}|j}|jj||jj|d|j_ |j jddd|t|di}|j t ||j |jj dt j|jjd ddd t|di}|j t ||j |jj dt j|jj| ddd t| di}|j t ||j |jj d dS) Nr EditorWindowr.r;boldrz Test Font)rDz font-sizez font-boldZ20)r ZGetFontrstrr#r1r0r2r&r3r/r7mainpagerr)r+Z default_fontZ default_sizeZ default_boldr9expectedrrr test_font_sets6         zFontPageTest.test_font_setcCs|j}|`|j|jf}ii|_|_|jjd|jjd|jjdddi}|j|j|j|jkor|kn|\|_|_t |_dS)Ntest5r.rDrU)r[r\rU) r#r&Z font_samplehighlight_sampler/r0r1r2rRr)r+r9Z orig_samplesrYrrrtest_set_sampless    " zFontPageTest.test_set_samplesN)__name__ __module__ __qualname____doc__ classmethodr)r*r,r:rErMrPrSrZr^rrrrr!3s   $r!c@s(eZdZeddZddZddZdS) IndentTestcCstj|_|jjdS)N)rr"r#r')r(rrrr)szIndentTest.setUpClasscCs0|j}|jjd|j|j|jjddS)N)r# space_numr0Z load_tab_cfgr7r5)r+r9rrrtest_load_tab_cfgs zIndentTest.test_load_tab_cfgcCsD|j}tj|jjd|j|jjd|jtdddiidS)NreZIndentz num-spacesZ16) r#rrZ indent_scaler0r7rgr5rX)r+r9rrrtest_indent_scales  zIndentTest.test_indent_scaleN)r_r`rarcr)rhrjrrrrrds rdc@seZdZdZeddZeddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,S)- HighPageTestzTest that highlight tab widgets enable users to make changes. Test that widget actions set vars, that var changes add options to changes and that themes work correctly. cCsDtj}|_tjj|t|_t|_t|_t|_ |j dS)N) rhighpager#r$r%rset_theme_typepaint_theme_sampleset_highlight_targetset_color_sampler')r(r#rrrr)s  zHighPageTest.setUpClasscCs|j}|`|`|`|`dS)N)r#rmrnrorp)r(r9rrrr*szHighPageTest.tearDownClasscCsX|j}x$tjddD]}tjdj|qWtjd|j_d|j _d|j _d|j _dS)Nuserrr) r#r GetSectionListrremove_sectionrrrmr3rnrorp)r+r9sectionrrrr,szHighPageTest.setUpcCstj|j}|j}tjddt_|j|j |j j ||j j d||j j d||jjd||jjd||jjd||jjdtjdddd tjdd d d |j||j j d||j j d||jjd ||jjd ||jjd tjd dt_tjdddd|j|j|j j ||j j d||j j d ||jjd||jjd||jjdt`tjdS)Nz IDLE Classic) return_valuez- no custom themes -disabledr.rtest1optionvaluetest2option2value2r;rThemedefault0rV)rv)rrr#r7rMockr Z CurrentThemeZload_theme_cfgrR theme_sourcer5 builtin_name custom_namecustom_theme_onstatermr3rnro SetOptionr6r8)r+r9eqrrrtest_load_theme_cfg s>z HighPageTest.test_load_theme_cfgcCs|j}|j}t|_t|_|jj|tdddii||jjd||jjdt j |j j d|j j|jtdddii||jjd||jjd|`|`dS) Nr}r~Truer.r !disabledFalse)r) r7r#rvar_changed_builtin_namevar_changed_custom_nameZbuiltin_theme_onrQrXr3rrrr)r+rr9rrrtest_theme_source2s   zHighPageTest.test_theme_sourcecCs|j}|j}dddg}tjdddd|jj|d|tddddi||jd d ||jj d t j tjdddd|jj|d|tdd dii||jd d ||jj d t j |jj|d|tddddi||jd d||jj ddS)Nz IDLE Classicz IDLE DarkzIDLE Newrr}namespam)rname2textzNew theme, see Helpr.rr;rrV) r7r#r r builtinlistSetMenurXZ theme_messagernr3rr)r+rr9 item_listrrrtest_builtin_nameGs(  zHighPageTest.test_builtin_namecCst|j}|jjgd|jdt|j|jjdtj |jjdddgd|jtdddii|j|jjddS) Nz- no custom themes -r}rabcrr.) r# customlistr assertNotInrXr7rnr3rr)r+r9rrrtest_custom_namecs zHighPageTest.test_custom_namecCs2|j}t|_|jjd|j|jjd|`dS)NZgreenr.)r#rZon_new_color_setcolorr0r7r3)r+r9rrr test_colorqs  zHighPageTest.test_colorcCsB|j}|j}|jjdddgd||jjd||jjddS)Nrrrr.)r7r#Z targetlistrhighlight_targetr5ror3)r+rr9rrr test_highlight_target_list_mouseys z-HighPageTest.test_highlight_target_list_mousecs|j}|ji}d}jjjdjfdd}fdd}||x`jD]T}xNj|dddD]6}|d7}|||jj |||j j |qxWq^WdS) Nrg?cs(x"jjD]\}}|||d<q WdS)Nr)Ztheme_elementsitems)elemelementtag)r9rrtag_to_elementszEHighPageTest.test_highlight_target_text_mouse..tag_to_elementcsnj|\}}}}||d7}||d7}jddddjd||djd||djd||ddS)Nr;zr)rFrGzzz)rJrA)startrFrGrKrL)hsrrclick_its  z?HighPageTest.test_highlight_target_text_mouse..click_itr;r.) r7r#r]r@rIrZ tag_namesZ tag_rangesrr5ror3)r+rrcountrrrZ start_indexr)r9rr test_highlight_target_text_mouses"   z-HighPageTest.test_highlight_target_text_mousecCs|j}|j}|`|jjd|j||jdt||jdt||j j d|jjd|j||jdt||j j d||jdt||j j ft |_dS)NTrrvFselected)rv)r) r7r#rmrr0rr rr button_delete_customrrr)r+rr9rrrtest_set_theme_types  z HighPageTest.test_set_theme_typecCsX|j}|j}tjj}t}tj_t}|_|jjd|j jdd |_ |j j ||j j dd|jj|jddf|_ |j j ||j j dd|_ |j jd|jjd d|_ |j j ||jd ||j j dd |_ |j j ||jj |j ||j j d|j jd|jjd |j j ||j j d|`|tj_dS)NzEditor Breakpointz#ffffffrstyle backgroundk@#de0000Tr.z My New ThemeF)NNrrr)rr)r7r#rZtkColorChooserZaskcolorrget_new_theme_namerr0rresultZbutton_set_colorrQr5rlookupframe_color_setrr3r)r+rr9Z orig_chooserZchoosergntnrrrtest_get_colors<             zHighPageTest.test_get_colorcCs|j}d}|jjd|jjd|jjd|jj||j|jj|j dd||j|j j dd||jt dd |iidS) Nz#3f7caePythonz Selected TextTrrhilite foregroundzhilite-foreground) r#rr0r fg_bg_togglerr7rrrr]tag_cgetrl)r+r9rrrrtest_on_new_color_sets    z"HighPageTest.test_on_new_color_setcCs>tj}tdd}t_|j}d|_|j|jdd|t_dS)NT) return_selfz New Themer)r SectionNamerr#rr7r)r+orig_sectionnamesnr9rrrtest_get_new_theme_names z$HighPageTest.test_get_new_theme_namecCs|j}t}|_|jjdd|_|jj|j|jt j dd|_d|_ |j|jt j d|jj|j |jt j d|`dS)NTrrz my new themer) r#rrrr0rZbutton_save_customrQrr rr3rB)r+r9rrrrtest_save_as_new_themes    z#HighPageTest.test_save_as_new_themecCs(|j}|j}|jjd|jjdd}d}|j|tj|j||tj dd|g|tj ddtj d|||j j ||j |jj ||jjdtjd|d d |j|tj|j||tj dd||g|jtj d|tj d|tjd|d d |tj d|tj d|dS) NTz IDLE Classiczmy new custom themezmy second custom themerqrr~r.zhit-backgroundyellow)r7r#rr0rrr r create_newrrZ GetThemeDictrr5r6rmr3r add_optionr4r)r+rr9 first_new second_newrrrtest_create_new_and_save_news.      z)HighPageTest.test_create_new_and_save_newcCs|j}|j}|`|jjd||jjd||jjd|j|j ||j j d|jjd||jjd ||jjf|j|j ||j j dt |_dS) NZCursorrvrr.Commentr;)rvr)rv)r) r7r#rorr0fg_onrbg_onrRrrpr3r)r+rr9rrrtest_set_highlight_target5s    z&HighPageTest.test_set_highlight_targetcCs@|j}|j}|jj|j|jd|jj|j|jddS)Nr.r;)r#rprrQr7r3r)r+r9Zscsrrrtest_set_color_sample_bindingJs   z*HighPageTest.test_set_color_sample_bindingcCs\|j}|`|jjd|jjd|j|j|jj|jdd|j j ddt |_dS)Nz Selected TextTrrrr) r#rprr0rr7rrrr]rr)r+r9rrrtest_set_color_sampleTs  z"HighPageTest.test_set_color_samplecCsX|j}|j}|`|jj}tj}d}d}|jjd|j jdd}|j |d|j _ |j||d|||ddd ||d |||d d d |j |d |d|j |d |d||j j dtjd|ddtjd|dd|j||d|||ddd ||d |||d d d ||d |d||d |d||j j dt|_dS)NrrTz IDLE Darkz IDLE Testrbreakfg)ZfgBgZcursorZnormalbgZconsoleZbluerr.rzconsole-foregroundzconsole-backgroundr;)r7r#rnr]rr Z GetHighlightrr0rrrpr3r4rrr)r+rr9Zhs_tagZghrrZthemerrrtest_paint_theme_sample_s6   z$HighPageTest.test_paint_theme_samplecCsp|j}|j}|jjdt}|_tt_tt_d}t j dj |ddddit |<|j jd|jj|d|_|jj||jd |t |ddi|t jd ddg|tjjd |tjjd ||jjd d |_|jj||jd |j|t |t jd dg||jjd||jjd|tjjd |tjjd ||jjd t`t`|`dS)N !disabledz spam themerrryrxrFr.rqrTr;rvz- no custom themes -)r)rv)r7r#rrraskyesnordeactivate_current_configactivate_config_changesr rrrlrr0rrrQr3rrrmrrr5)r+rr9yesnoZ theme_namerrrtest_delete_customs>          zHighPageTest.test_delete_customN)r_r`rarbrcr)r*r,rrrrrrrrrrrrrrrrrrrrrrrks,  ) %/     %rkc@seZdZdZeddZeddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"S)# KeysPageTestzTest that keys tab widgets enable users to make changes. Test that widget actions set vars, that var changes add options to changes and that key sets works correctly. cCs,tj}|_tjj|t|_t|_dS)N)rkeyspager#r$r%r set_keys_typeload_keys_list)r(r#rrrr)s  zKeysPageTest.setUpClasscCs|j}|`|`dS)N)r#rr)r(r#rrrr*szKeysPageTest.tearDownClasscCsH|j}x$tjddD]}tjdj|qWtjd|j_d|j _dS)Nrqrr) r#r rrrrsrrrr3r)r+r9rtrrrr,s zKeysPageTest.setUpcCstj|j}|j}tjddt_|j|j |j j ||j j d||j j d||jjd||jjd||jjd||jjdtjdddd tjdd d d |j||j j d||j j d||jjd ||jjd ||jjdtjd dt_tjddt_tjdddd|j|j|j j ||j j d||j j d ||jjd||jjd||jjdt`t`tjdS)NIDLE Classic OSX)ruz- no custom keys -rvr.rrwrxryrzr{r|r;zIDLE Modern UnixrKeysr~rrV)rv)r)r)rz)rrr#r7rrr Z CurrentKeysZ load_key_cfgrR keyset_sourcer5rrcustom_keyset_onrrr3rargsrZ default_keysr6r8)r+r9rrrrtest_load_key_cfgs@zKeysPageTest.test_load_key_cfgcCs|j}|j}t|_t|_|jj|tdddii||jjd||jjdt j |j j d|j j|jtdddii||jjd||jjd|`|`dS) Nrr~rr.r !disabledr)r) r7r#rrrZbuiltin_keyset_onrQrXr3rrrr)r+rr9rrrtest_keyset_sources   zKeysPageTest.test_keyset_sourcecCs2|j}|j}tjdjddddg}|jj|d|tddddi||jdd||j j d ||j j dt j tjddd d |jj|d|tdd dii||jdd||j j d ||j j dt j |jj|d|tddddi||jdd||j j d||j j ddS)NrrzIDLE Classic WindowsIDLE Classic OSXIDLE Modern UNIX)rrrzNew key set, see Helpr.rzIDLE Classic Unixrr;rrV)r)r)r)r7r#r rrsrrrXZ keys_messagerr3rrrr)r+rr9rrrrr s0 zKeysPageTest.test_builtin_namecCst|j}|jjgd|jdt|j|jjdtj |jjdddgd|jtdddii|j|jjddS) Nz- no custom keys -rrrrrrr.) r#rrrrXr7rr3rr)r+r9rrrr*s zKeysPageTest.test_custom_namecCstjdddd|j}|jjd|jjdd|jjdd|jjd d |jjd|jj d|j jd |j t ddd ii|jjd |jj d |j jd |j t d d d iidS) NrZZzDummyenablerzmy custom keysrendcopyr.zz-inz ZZzDummy_cfgBindings)r rr#rr0 bindingslistdeleteinsert selection_setselection_anchor keybindingr7rextpage)r+r9rrrtest_keybinding8s        zKeysPageTest.test_keybindingcCs|j}|j}|`|jjd|j||jdt||jdt||j j d|jjd|j||jdt||j j d||jdt||j j ft |_dS)NTrrvFr)rv)r) r7r#rrr0rr rr button_delete_custom_keysrrr)r+rr9rrrtest_set_keys_typeMs  zKeysPageTest.test_set_keys_typecCs|j}|j}tj}tdd}t_t}|_|jjd|jj dd|jj dd|jj d|jj d|j jd|jjdd|_|jj||jjd d||j jdd |_d|_|jj||jd ||jjd dd |_|jj||jj|j||jjd d ||j jd |jjdd|_d|_|jj||jd||jjd d||j jd|`|t_dS)NT)r !disabledrrzcopy - zKey-arrHz r.zMy New Key Setzcopy - Fzzcopy - )r)r7r#rZ GetKeysDialogrget_new_keys_namebutton_new_keysrrrrrrrr0rrrQr5r3r)r+rr9Zorig_getkeysdialogZgkdgnknrrrtest_get_new_keysbsF             zKeysPageTest.test_get_new_keyscCs>tj}tdd}t_|j}d|_|j|jdd|t_dS)NT)rzNew Keysr)rrrr#rr7r)r+rrr9rrrtest_get_new_keys_names z#KeysPageTest.test_get_new_keys_namecCst|j}t}|_|jjdd|_|jjd|_d|_|j |jt j d|jj|j |jt j d|`dS)NTrzmy new key setrr) r#rrrr0rZbutton_save_custom_keysrQr3rr rrB)r+r9rrrrtest_save_as_new_key_sets    z%KeysPageTest.test_save_as_new_key_setcCs|j}|j}|jdd|jdd|jdd|jd|j|jd|j|jd\}}}}||d7}||d7}|j dddd|j d ||d|j d ||d|j d ||d|j |j d d|j |j j fdS) Nrrrr.findr;z)rFrGzz zrH)r#rrrr?r@rIr'rJrAr7r5rr)r+r9rrFrGrKrLrrrtest_on_bindingslist_selects$       z(KeysPageTest.test_on_bindingslist_selectcCs|j}|j}|jjd|jjdd}d}|j|tj|j||tj dd|g|tj dtj |||j j ||j |jj ||jjdtjd|dd |j|tj|j||tj dd||g|jtj |tj |tjd|dd |tj |tj |dS) NTzIDLE Classic Windowszmy new custom key setzmy second custom keysetrqrr.rz )r7r#rr0rrr rZcreate_new_key_setrr GetKeySetrr5r6rr3rrr4r)r+rr9rrrrr,test_create_new_key_set_and_save_new_key_sets,        z9KeysPageTest.test_create_new_key_set_and_save_new_key_setcCsV|j}|j}t}t_|`|j}|jdd|jdd|jddddgdgd gd |_ t j d d d dd}|jd ||j dd|||j dd||j f|jd|jd|jd ||j dd|||j dd||j d|jd|jd|jd ||j dd|||j dd||j dt|_t`dS)Nrrz<>r.z<>zzzz )z<>z<>z<>rzmy keysrz © - ,force-open-completions - spam - rHrr;)rrr)r.)r;)r7r#rr rrrrrrrrr5Z curselectionrr)r+rr9ZgksrrYrrrtest_load_keys_listsB            z KeysPageTest.test_load_keys_listcCsp|j}|j}|jjdt}|_tt_tt_d}t j dj |ddddit |<|j jd|jj|d|_|jj||jd |t |ddi|t jd ddg|tjjd |tjjd ||jjd d |_|jj||jd |j|t |t jd dg||jjd||jjd|tjjd |tjjd ||jjd t`t`|`dS)N !disabledz spam key setrrryrxrFr.rqrTr;rvz- no custom keys -)r)rv)r7r#rrrrrrrr rrrrr0rrrQr3rrrrrr5)r+rr9rZ keyset_namerrrtest_delete_custom_keys s>          z$KeysPageTest.test_delete_custom_keysN)r_r`rarbrcr)r*r,rrrrrrrrrrrrrrrrrrs"   * 0 +rc@seZdZdZeddZeddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#Zd$S)% GenPageTestzTest that general tab widgets enable users to make changes. Test that widget actions set vars, that var changes add options to changes and that helplist works correctly. cCs@tj}|_tjj|t|_|_t|_|_ |j dS)N) rZgenpager#r$r%rr0set_add_delete_stateupcupdate_help_changesr')r(r#rrrr)=s   zGenPageTest.setUpClasscCs2|j}|`|`|`|`|jjdd|jjdS)Nrr) r#r0r r r helplistr user_helplistr)r(r#rrrr*Es zGenPageTest.tearDownClasscCs tjdS)N)rr)r+rrrr,MszGenPageTest.setUpcCs|j}|j}|jjd|jjd|jjd|jjd|jjddddg|_ t j dddd|j ||jj d ||jj d ||jj d ||jj d ||jj d dd||j dgdS)Nr.rZbadZworser HelpFilesr-z name;filerZ80rOrfile)r)rrr-)r7r#Z startup_editr0autosaveZ win_widthZ win_heightr rr r rZload_general_cfgr5)r+rr9rrrtest_load_general_cfgPs      z!GenPageTest.test_load_general_cfgcCsN|j}|jj|jtdddiitj|jj|jtdddiidS)NGeneralzeditor-on-startupr-r)r#Zstartup_editor_onrQr7rXrrZstartup_shell_on)r+r9rrr test_startupcs  zGenPageTest.test_startupcCsr|j}|jjdd|jjdd|jtdddiitj|jjdd|jjdd|jtdddiidS)Nrr11rTZheightwidth) r#Zwin_height_intrrr7rXrrZ win_width_int)r+r9rrrtest_editor_sizemszGenPageTest.test_editor_sizecCs8|jjjdd|jjjdd|jtdddiidS)NrrrZ AutoCompleteZ popupwait)r#Z auto_wait_intrrr7r)r+rrrtest_autocomplete_waitwsz"GenPageTest.test_autocomplete_waitcCs|j}|j}|jdjd|tdddiitj|jjdd|jj dd|tdddiitj|j j|tdd d iidS) NZmenurZ ParenMatchropenerrrz flash-delayZbellr) r#r7Zparen_style_typerQrrrZparen_flash_timerrZbell_on)r+r9rrrrtest_parenmatch|s zGenPageTest.test_parenmatchcCsF|j}|jj|jtdddii|jj|jtdddiidS)Nrrr-r)r#Z save_auto_onrQr7rXZ save_ask_on)r+r9rrr test_autosaves   zGenPageTest.test_autosavecCs8|jjjdd|jjjdd|jtdddiidS)NrrrZFormatParagraphz max-width)r#Zformat_width_intrrr7r)r+rrrtest_paragraphszGenPageTest.test_paragraphcCs8|jjjdd|jjjdd|jtdddiidS)Nrrr-Z CodeContextZmaxlines)r#Z context_intrrr7r)r+rrr test_contextszGenPageTest.test_contextcCs|j}|j|_|j|_|j}d}|j|d|j||j|j ||j |j |\}}}}||d7}||d7}d|j_ |j_ |j dddd|j d||d|j d||d|j d ||d|j|jd d|j|jj |j|jj dS) Nrsourcer;rz)rFrGzz zrH)r#r r0r r r rr?r@rIr'rJr3rAr7r5rRr6)r+r9r ZdexrFrGrKrLrrrtest_source_selecteds*     z GenPageTest.test_source_selectedcCs|j}|j}|`|j}|j}|jdd|||jjd||jjd|jdd|||jjd||jjd|j d|||jjf||jjft |_dS) Nrrrvr)rv)rv)rv)rv) r7r#r r rZbutton_helplist_editrZbutton_helplist_removerrr)r+rr9Zsadhrrrtest_set_add_delete_states$   z%GenPageTest.test_set_add_delete_statecCs|j}tj}tdd}t_|j}|jjdd|jjd|j _ |j _ d|_ |j |jt|jjdd|jko~gkn|j|j j d |_ |j d |_ |j ||jjddd ||jddg||j j d |j|j j |t_dS)NT)rrrrname1file1rfile2r;)r!r")rr#)r!r)r!r")rr#)r7r HelpSourcerr#r rr rr0r3r rZhelplist_item_addrRlistr5r6)r+rorig_helpsourcerr9rrrtest_helplist_item_adds* z"GenPageTest.test_helplist_item_addcCs*|j}tj}tdd}t_|j}|jjdd|jjdd|jjd|jj d|j j |j j d d|j _|j_d|_|jd |_|j||jjddd ||j dg|j|jjd|_|j||jjddd||j dg|j|jj|j jkod kn|t_dS)NT)rrrr!r"rrr#r.)r!r")r!r")r!)r!r")rr#)r)rr#)r7rr$rr#r rrrrr rappendr0r3r rZhelplist_item_editr5r6rR)r+rr&rr9rrrtest_helplist_item_edits0    (z#GenPageTest.test_helplist_item_editcCs|j}|j}|jjdd|jjdd|jjd|jjd|jj|jj dd|j _ |j _ |j ||jjddf||jg|j|j j |j j kodkndS)Nrrr!r"r.)r!r")r7r#r rrrrr rr(r0r3r Zhelplist_item_remover5rR)r+rr9rrrtest_helplist_item_removes     z%GenPageTest.test_helplist_item_removecCsV|j}|`|jj|jjd |jjd |j|jtddddt|_dS) Nr!r"rr#rz name1;file1z name2;file2)r-2)r!r")rr#)r#r r rr(r7rXr)r+r9rrrtest_update_help_changess     z$GenPageTest.test_update_help_changesN)r_r`rarbrcr)r*r,rrrrrrrrrr r'r)r*r,rrrrr7s$     rc@sdeZdZeddZeddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS) VarTraceTestcCs"tj|_tt|_tt|_dS)N)rZVarTracerrrivr bv)r(rrrr)#s  zVarTraceTest.setUpClasscCs|`|`|`dS)N)rr.r/)r(rrrr*)szVarTraceTest.tearDownClasscCs|jjd|_dS)Nr)rrr3)r+rrrr,-s zVarTraceTest.setUpcGs|jd7_dS)N )r3)r+paramsrrrvar_changed_increment1sz"VarTraceTest.var_changed_incrementcGsdS)Nr)r+r1rrrvar_changed_boolean4sz VarTraceTest.var_changed_booleancCs.|j}|j|j|jg|j|jgdS)N)r__init__r7untracedtraced)r+trrrr test_init7szVarTraceTest.test_initcCsF|j}|jjd|jjd|j|j|jg|j|jgdS)Nrr.)rr5r(r6rr7)r+r7rrr test_clear=s   zVarTraceTest.test_clearc Cs|j}t}tj|d}|_|j|j|j}|j||j|j|j |j }|j||j t t }|j|d}|j|||j |j|d||jf||j f||fg}|j|jg|j|j||`dS)N)rurrtrx)rrtrx)rrtrx)rrrr make_callbackaddr.r2ZassertIsr/r3rrZassert_called_onceZassert_called_withr7r6r5) r+r7funccbr.r/ZsvZsv2rYrrrtest_addEs$    zVarTraceTest.test_addcCst|jj|jd}|jt||jjd|jdtd||jdtd|j tddddtj dS)Nrrtrx*Z42)rrtrx) rr:r.rRcallabler0rrrBr7r)r+r=rrrtest_make_callback]s zVarTraceTest.test_make_callbackcCs|j}|j|j|j}|j|j|j}||jf||jfg}|j|j|jg|j |j ||j d|j|j d|j|j dd|_ |j|j d|j|j dd|_ |j|j|j g|j |j||j d|j|j ddS)Nr.r0r)rr;r.r2r/r3r8r7r5ZassertCountEqualr6r0r5r3r)r+r7r.r/rYrrrtest_attach_detachis*    zVarTraceTest.test_attach_detachN)r_r`rarcr)r*r,r2r3r8r9r>rArBrrrrr-!s   r-__main__r;) verbosity)*rbZidlelibrZ test.supportrZunittestrZidlelib.idle_test.mock_idlerZtkinterrrrr r r r Zidlelib.configdialogr rrrrZIdleUserConfParserrrrrXrlrrrr ZTestCaser!rdrkrrr-r_rrrrrsL       K kh