Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/idlelib/idle_test/__pycache__/test_configdialog.cpython-39.pyc

a

XC?h0��@s�dZddlmZddlmZed�ddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZdd	lmZdd
lmZmZmZejZe�d�e�d�e�d�e�d�d�Zdadaed
ZedZedZedZdd�Zdd�Z Gdd�dej!�Z"Gdd�dej!�Z#Gdd�dej!�Z$Gdd�dej!�Z%Gdd�dej!�Z&Gdd �d ej!�Z'Gd!d"�d"ej!�Z(Gd#d$�d$ej!�Z)Gd%d&�d&ej!�Z*Gd'd(�d(ej!�Z+e,d)k�r�ej-d*d+�dS),zfTest configdialog, coverage 94%.

Half the class creates dialog, half works with user customizations.
�)�configdialog)�requiresZguiN)�mock)�Func)�Tk�	StringVar�IntVar�
BooleanVar�DISABLED�NORMAL)�config)�idleConf�changes�tracers�)�main�	highlight�keys�
extensionsrrrrcCs tt_t�atjtddd�adS)NZTestT)Z_utest)�testcfgr
�userCfgr�rootrZConfigDialog�dialog�rr�H/opt/alt/python39/lib64/python3.9/idlelib/idle_test/test_configdialog.py�setUpModule"srcCs:tt_t��t��t��t��t�	�daa
dS�N)�usercfgr
rr�detach�clearrr�update_idletasks�destroyrrrrr�tearDownModule*sr"c@seZdZdd�Zdd�ZdS)�ConfigDialogTestcCsdSrr��selfrrr�test_deactivate_current_config7sz/ConfigDialogTest.test_deactivate_current_configcCsdSrrr$rrr�activate_config_changes:sz(ConfigDialogTest.activate_config_changesN)�__name__�
__module__�__qualname__r&r'rrrrr#5sr#c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
ButtonTestcCsJt}t��}|_t��}|_|jd��|��|��|`|`dS)NZOk)rr�Mock�applyr!�buttons�invoke�assert_called_once)r%�dr-r!rrr�
test_click_ok@szButtonTest.test_click_okcCsht}t��}|_t��}|j_t��}|_|jd��|�	�|�	�|�	�|j`|`|`dS)NZApply)
rrr,�deactivate_current_config�extpageZsave_all_changed_extensionsr'r.r/r0)r%r1Z
deactivateZsave_ext�activaterrr�test_click_applyIszButtonTest.test_click_applycCsNt}t�|_dtdd<|jd��|�tdi�|�|jjd�|`dS)N�rZ	somethingZCancel)rrr!rr.r/�assertEqual�called�r%r1rrr�test_click_cancelUszButtonTest.test_click_cancelcCs�tj�tj�tjjtdtd��4}tj	d�
�|jd|jd}}Wd�n1sZ0Y|�|d�|�
|�d�o�|�d��dS)	NZ	view_text)Znew_callableZHelp�title�contentszHelp for IDLE preferenceszWhen you clickza different name.
)r�note�select�keyspagerZpatch�objectrrr.r/�kwdsr8�
assertTrue�
startswith�endswith)r%Zviewr<r=rrr�test_click_help^s
�4�zButtonTest.test_click_helpN)r(r)r*r2r6r;rFrrrrr+>s		r+c@sheZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)�FontPageTestz�Test 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}|_tj�|�t�|_|��dSr)rZfontpage�pager>r?r�set_samples�update��clsrHrrr�
setUpClasspszFontPageTest.setUpClasscCs
|j`dSr)rHrI�rLrrr�
tearDownClasswszFontPageTest.tearDownClasscCst��dSr�rrr$rrr�setUp{szFontPageTest.setUpcCs�t��|j}|j�d�|j�d�|j�d�d|j_|�	�|�
|j��d�|�
|j��d�|�|j���|�
|jjd�t��dS)NZFake�1Trr7)rrrH�	font_name�set�	font_size�	font_boldrIr9Z
load_font_cfg�assertNotEqual�get�assertFalser8�attachr:rrr�test_load_font_cfg~szFontPageTest.test_load_font_cfgcCs�|j}|j��dkr|�d�|j}|�d�|j�d�}|��|��|�d�|�d�|�d�}|�	||�|�
|j��|���|��|��|�d�|�d�|�d�}|�
||�|�
|j��|���dS)	N��need at least 2 fontsrZactivez
<Key-Down>z<KeyRelease-Down>z<Key-Up>z<KeyRelease-Up>)rH�fontlist�size�skipTestr5rX�focus_forcerJ�event_generaterW�assertInrS�lowerr8)r%r1r^�fontZ	down_fontZup_fontrrr�test_fontlist_key�s(







zFontPageTest.test_fontlist_keyc	Cs�|j}|j��dkr|�d�|j}|�d�|��|�d�|��|�d�\}}}}||d7}||d7}|j	d||d�|j	d||d�|�
d�}|�
d�}|�||�|�|j
�
�|���dS)	Nr\r]rr7�
<Button-1>��x�y�<ButtonRelease-1>�anchor)rHr^r_r`r5ra�seerJ�bboxrbrXr8rcrSrd)	r%r1r^rirj�dx�dyZfont1Zselect_fontrrr�test_fontlist_mouse�s"




z FontPageTest.test_fontlist_mousecCs*|j}|jj�d�|�|j��d�dS)N�(�40)rHZsizelistZvariablerTr8rUrXr:rrr�
test_sizelist�szFontPageTest.test_sizelistcCsJ|j}|j�d�|j��|�|j���|j��|�|j���dS)NF)rHrVrTZbold_toggler/rCrXrYr:rrr�test_bold_toggle�s

zFontPageTest.test_bold_togglecCst�tdd�}t|d�}|ddk}|j}|j�|�|j�|�d|j_	|j
�d�dd|t|�d�i}|�t|�|�|jj	d�t
��|j�d	�ddd	t|�d�i}|�t|�|�|jj	d�t
��|j�|�ddd	t|�d�i}|�t|�|�|jj	d
�dS)Nr�EditorWindowr7r\�boldrz	Test Font)rez	font-sizez	font-boldZ20�)r
ZGetFontr�strrHrUrTrVrIr9rSr8�mainpagerr)r%Zdefault_fontZdefault_sizeZdefault_boldr1�expectedrrr�
test_font_set�s<���zFontPageTest.test_font_setcCs�|j}|`|j|jf}ii|_|_|j�d�|j�d�|j�d�ddi}|��|�|j|jkor|kn�|\|_|_t	�|_dS)N�test�5r7re)r}r~rw)
rHrIZfont_sample�highlight_samplerSrTrUrVrCr)r%r1Zorig_samplesr{rrr�test_set_samples�s"zFontPageTest.test_set_samplesN)r(r)r*�__doc__�classmethodrMrOrQr[rfrqrtrur|r�rrrrrGis

	$rGc@s�eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0S)1�HighPageTestz�Test 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}|_tj�|�t�|_t�|_t�|_t�|_	|�
�dSr)r�highpagerHr>r?r�set_theme_type�paint_theme_sample�set_highlight_target�set_color_samplerJrKrrrrMszHighPageTest.setUpClasscCs|j}|`|`|`|`dSr)rHr�r�r�r�)rLr1rrrrOszHighPageTest.tearDownClasscCsT|j}t�dd�D]}tjd�|�qt��d|j_d|j	_d|j
_d|j_dS)N�userrr)rHr
�GetSectionListr�remove_sectionrrr�r9r�r�r��r%r1�sectionrrrrQszHighPageTest.setUpcCs�t��|j}|j}tjdd�t_|��|�	|j
���||j��d�||j
��d�||j��d�||jjd�||jjd�||jjd�t�dddd	�t�dd
dd�|��||j��d�||j
��d�||jjd
�||jjd
�||jjd
�tjd
d�t_t�dddd�|��|�|j
���||j��d�||j
��d
�||jjd�||jjd�||jjd�t`t��dS)N�IDLE Classic�Zreturn_value�- no custom themes -��disabledr7r�test1�option�value�test2�option2�value2r\r�Theme�default�0rx)rrrHr8rr,r
ZCurrentThemeZload_theme_cfgrC�theme_sourcerX�builtin_name�custom_name�custom_theme_on�stater�r9r�r��	SetOptionrYrZ�r%r1�eqrrr�test_load_theme_cfg*s>z HighPageTest.test_load_theme_cfgcCs�|j}|j}t�|_t�|_|j��|tdddii�||jjd�||jjd�t	�
�|j�d�|j��|�tdddii�||jjd�||jjd�|`|`dS)Nr�r��Truer7r�z	!disabled�False)
r8rHr�var_changed_builtin_name�var_changed_custom_nameZbuiltin_theme_onr/rzr9rrr�r��r%r�r1rrr�test_theme_sourceSs

zHighPageTest.test_theme_sourcecCs|j}|j}gd�}t�dddd�|j�|d�|tdddd�i�||jd	d
�||jj	d�t
��t�dddd�|j�|d�|tdd
dii�||jd	d
�||jj	d�t
��|j�|d�|tdddd�i�||jd	d�||jj	d�dS)N)r��	IDLE Dark�IDLE Newrr��name�spamr�r��r��name2�textzNew theme, see Helpr7r�r�r\rrx)r8rHr
r��builtinlist�SetMenurzZ
theme_messager�r9rr�r%r�r1Z	item_listrrr�test_builtin_namehs*�
zHighPageTest.test_builtin_namecCsr|j}|j�gd�|�dt�|�|jjd�t�	�|j�gd�d�|�tdddii�|�|jjd�dS)Nr�r�r��a�b�cr�r�r7)
rH�
customlistr��assertNotInrzr8r�r9rrr:rrr�test_custom_name�szHighPageTest.test_custom_namecCs2|j}t�|_|j�d�|�|jjd�|`dS)NZgreenr7)rHrZon_new_color_set�colorrTr8r9r:rrr�
test_color�s
zHighPageTest.test_colorcCs@|j}|j}|j�gd�d�||j��d�||jjd�dS)Nr�r�r7)r8rHZ
targetlistr��highlight_targetrXr�r9r�rrr� test_highlight_target_list_mouse�s
z-HighPageTest.test_highlight_target_list_mousecs�|j}|j�i}d}�j������d�����fdd�}�fdd�}||����D]P}��|�ddd�D]6}|d7}||�|�j�	�||�|�j
j|�qtq\dS)	Nr��?cs$�j��D]\}}|||d<q
dS�Nr)Ztheme_elements�items)�elemZelement�tag)r1rr�tag_to_element�szEHighPageTest.test_highlight_target_text_mouse.<locals>.tag_to_elementcsn��|�\}}}}||d7}||d7}�jdddd��jd||d��jd||d��jd||d�dS)Nr\�<Enter>rrh�<Motion>�<ButtonPress-1>rk)rnrb)�startrirjrorp)�hsrr�click_it�sz?HighPageTest.test_highlight_target_text_mouse.<locals>.click_itr\r7)r8rHrrarmr Z	tag_names�
tag_rangesr�rXr�r9)r%r�r��countr�r�r�Zstart_indexr)r1r�r� test_highlight_target_text_mouse�s"

z-HighPageTest.test_highlight_target_text_mousecCs�|j}|j}|j}|��|�d�|��|jdddd�|jdddd�td�D]$}|jdddd�|jdddd�qT||�d	�d
�dS)Nr�r�rrhr�r\r�rk�selr)	r8rHrrarmr rb�ranger�)r%r�r1r��_rrr�"test_highlight_sample_double_click�s
z/HighPageTest.test_highlight_sample_double_clickc	Cs�|j}|j}|j}|��|�d�|��|�d�\}}}}}|�d�|�d�|jd||d�|jd||d�|jd||d�|jd	||d�||�d
�d�dS)Nr�z1.0z<Leave>r�r�rhr�z<B1-Motion>rkr�r)	r8rHrrarmr Z	dlineinforbr�)	r%r�r1r�rirjrorp�offsetrrr�test_highlight_sample_b1_motion�s


z,HighPageTest.test_highlight_sample_b1_motioncCs�|j}|j}|`|j�d�|��||jdt�||jdt�||j	�
�d�|j�d�|��||jdt�||j�
�d�||jdt�||j	�
�d�t�|_dS�NTr�r�F��selectedr)
r8rHr�r�rTr�rr�r
�button_delete_customr�r�rr�rrr�test_set_theme_type�sz HighPageTest.test_set_theme_typecCsX|j}|j}tjj}t�}tj_t�}|_|j�d�|j	�d�d|_
|j��||j	�
�d�d|j�|jdd�f|_
|j��||j	�
�d�d|_
|j	�d�|j�d�d|_
|j��||jd	�||j	�
�d�d
|_
|j��||j�
�|j
�||j	�
�d�|j	�d�|j�d�|j��||j	�
�d�|`|tj_dS)
NzEditor Breakpointz#ffffff)NNr�style�
background))g��k@�r��#de0000Tr7zMy New Themer�F)r8rHrZcolorchooserZaskcolorr�get_new_theme_namer�rTr��resultZbutton_set_colorr/rXr��lookup�frame_color_setr�r9r�)r%r�r1Zorig_chooserZchooser�gntnrrr�test_get_colors<




zHighPageTest.test_get_colorcCs�|j}d}|j�d�|j�d�|j�d�|j�|�|�|j�|j	dd�|�|�|j
�dd�|�|�tdd	|ii�dS)
Nz#3f7cae�Python�
Selected TextTr�r��hilite�
foregroundzhilite-foreground)
rHr�rTr��fg_bg_toggler�r8r�r�r�r�tag_cgetr�)r%r1r�rrr�test_on_new_color_set6s
�z"HighPageTest.test_on_new_color_setcCs>tj}tdd�}t_|j}d|_|�|�d�d�|t_dS)NT�Zreturn_selfz	New Themer)r�SectionNamerrHr�r8r��r%Zorig_sectionnameZsnr1rrr�test_get_new_theme_nameCsz$HighPageTest.test_get_new_theme_namecCs�|j}t�}|_|j�d�d|_|j��|�|jt	j
d�d|_d|_|�|jt	j
d�|j��|�|jt	j
d�|`dS)NTrrzmy new themer)
rHrr�r�rTr�Zbutton_save_customr/r�r
rr9rc)r%r1r�rrr�test_save_as_new_themeMs

z#HighPageTest.test_save_as_new_themecCs(|j}|j}|j�d�|j�d�d}d}|�|tj�|�|�|t�	dd�|g�|t�
dd�t�
d|��||j��|�|�
|j���||jjd�t�d|d	d
�|�|tj�|�|�|t�	dd�||g�|�t�
d|�t�
d|��t�d|d	d
�|t�
d|�t�
d|��dS)NTr�zmy new custom themezmy second custom themer�rr�r7zhit-background�yellow)r8rHr�rTr�r�r
r�
create_newr�ZGetThemeDictr�rXrYr�r9r�
add_optionrWr��r%r�r1Z	first_newZ
second_newrrr�test_create_new_and_save_new`s4

�

�
�z)HighPageTest.test_create_new_and_save_newcCs�|j}|j}|`|j�d�||j��d�||j��d�|�|j	�||j
jd�|j�d�||j��d�||j��d�|�|j	�||j
jd�t�|_dS)	NZCursor)r�r�r�r7�Commentr�rr\)
r8rHr�r�rT�fg_onr��bg_onrCr�r�r9rr�rrr�test_set_highlight_target�sz&HighPageTest.test_set_highlight_targetcCs@|j}|j}|j��|�|jd�|j��|�|jd�dS)Nr7r\)rHr�r�r/r8r9r�)r%r1Zscsrrr�test_set_color_sample_binding�s

z*HighPageTest.test_set_color_sample_bindingcCs\|j}|`|j�d�|j�d�|��|�|j�|jdd�|j	�
dd��t�|_dS)Nr�Tr�r�r�r�)rHr�r�rTr�r8r�r�r�rr�rr:rrr�test_set_color_sample�s�z"HighPageTest.test_set_color_samplec	Cs�|j}|j}|`|jj}tj}|j�d�|j	�d�d}|�
|�d|j_|��ddd�}|�
�D]\}}|�|d|�|�qf||jjd	�|�
�D]\}}t�d
|d||�q�|��|�
�D]\}}||d|�|�q�||jjd�t�|_dS)
NTr�z	IDLE TestrZbluer�)r�r�Zconsoler7rzconsole-r\)r8rHr�rr�r
ZGetHighlightr�rTr�r�r�r9r�rWrr�r)	r%r�rHZhs_tagZghZthemeZnew_console�keyr�rrr�test_paint_theme_sample�s0
�z$HighPageTest.test_paint_theme_samplecCs2|j}|j}|j�d�t�}|_t�t_t�t_d}t	j
d�|dd�ddit|<d}t	j
d�|dd�dd	it|<|j
�d�|j
��|j�|�d
|_|j��||jd�|t|ddi�|t	�dd�||g�|tjjd
�|tjjd
�||jjd
�d|_|j��||jd�|�|t�|t	�dd�|g�||j
��d�||j��|�|tjjd�|tjjd�||jjd�|j�|�d|_|j��||jd�|�|t�|t	�dd�g�||j
��d�||j��d�|tjjd�|tjjd�||jjd�t`t`|`dS)Nr�z
spam themerr�r�r�r�zother themer�Fr7r�rTr\rrxr�r�)r8rHr�r�r�askyesnorr3r'r
rr�r�r�r/r�rTr�r9r�r�r�rX)r%r�r1�yesnoZ
theme_nameZtheme_name2rrr�test_delete_custom�s\



zHighPageTest.test_delete_customN)r(r)r*r�r�rMrOrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr�s4
	
)	%/

 
 r�c@s�eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#�KeysPageTestz�Test 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}|_tj�|�t�|_t�|_dSr)rr@rHr>r?r�
set_keys_type�load_keys_listrKrrrrM
szKeysPageTest.setUpClasscCs|j}|`|`dSr)rHrrrKrrrrOszKeysPageTest.tearDownClasscCsD|j}t�dd�D]}tjd�|�qt��d|j_d|j	_dS)Nr�rr)
rHr
r�rr�rrrr9rr�rrrrQszKeysPageTest.setUpcCs�t��|j}|j}tjdd�t_|��|�	|j
���||j��d�||j
��d�||j��d�||jjd�||jjd�||jjd�t�ddd	d
�t�dddd
�|��||j��d�||j
��d�||jjd�||jjd�||jjd�tjdd�t_tjdd�t_t�dddd�|��|�|j
���||j��d�||j
��d�||jjd�||jjd�||jjd�t`t`t��dS)N�IDLE Classic OSXr��- no custom keys -r�r7�rrr�r�r�r�r�r�r\zIDLE Modern Unixr�Keysr�r�rx)r�)rrrHr8rr,r
ZCurrentKeysZload_key_cfgrC�
keyset_sourcerXr�r��custom_keyset_onr�rr9r�argsr�Zdefault_keysrYrZr�rrr�test_load_key_cfg#s@zKeysPageTest.test_load_key_cfgcCs�|j}|j}t�|_t�|_|j��|tdddii�||jjd�||jjd�t	�
�|j�d�|j��|�tdddii�||jjd�||jjd�|`|`dS)Nrr�r�r7rr�r�)
r8rHrr�r�Zbuiltin_keyset_onr/rzr9rrr
r�r�rrr�test_keyset_sourceMs

zKeysPageTest.test_keyset_sourcecCs0|j}|j}tjd�d�gd�}|j�|d�|tdddd�i�||jdd�||j	j
d	�||j	jd
�t�
�t�dddd�|j�|d�|tdd
dii�||jdd�||j	j
d�||j	jd
�t�
�|j�|d�|tdddd�i�||jdd�||j	j
d�||j	jd�dS)Nrr)�IDLE Classic Windowsr�IDLE Modern UNIXrrr�r�zNew key set, see Helpr7)rr�zIDLE Classic Unixr�r\rrrxr)r8rHr
rr�r�r�rzZkeys_messagerr9rrrr�r�rrrr�bs0�
zKeysPageTest.test_builtin_namecCsr|j}|j�gd�|�dt�|�|jjd�t�	�|j�gd�d�|�tdddii�|�|jjd�dS)Nrrrr�r�r�r7)
rHr�r�r�rzr8rr9rrr:rrrr��szKeysPageTest.test_custom_namecCs�t�dddd�|j}|j�d�|j�dd�|j�dd�|j�d	d
�|j�d�|j�	d�|j
�d�|�tdddii�|j�d	�|j�	d	�|j
�d�|�t
dd
dii�dS)
NrZZzDummyZenabler�zmy custom keysr�end�copyr7zz-in�	<Key-F11>ZZzDummy_cfgBindings)r
r�rHr�rT�bindingslist�delete�insert�
selection_set�selection_anchor�
keybindingr8r@r4r:rrr�test_keybinding�s$
�
�zKeysPageTest.test_keybindingcCs�|j}|j}|`|j�d�|��||jdt�||jdt�||j	�
�d�|j�d�|��||jdt�||j�
�d�||jdt�||j	�
�d�t�|_dSr�)
r8rHrr	rTr�rr�r
�button_delete_custom_keysr�r
rr�rrr�test_set_keys_type�szKeysPageTest.test_set_keys_typecCs�|j}|j}tj}tdd�}t_t�}|_|j�d�|j�	dd�|j�
dd�|j�d�|j�d�|j
�d�|j�d�d|_|j��||j�d	�d�||j
��d�d
|_d|_|j��||jd�||j�d	�d�d|_|j��||j��|j�||j�d	�d
�||j
��d
�|j�d�d|_d|_|j��||jd�||j�d	�d�||j
��d�|`|t_dS)NTr�r�rrzcopy - <Control-Shift-Key-C>zKey-arrlrr7zMy New Key Setzcopy - <Key-F11>Fz<Key-p>zcopy - <Key-p>)r8rHrZ
GetKeysDialogr�get_new_keys_name�button_new_keysr�rrrrrrrTr	r�r/rXr9r�)r%r�r1Zorig_getkeysdialogZgkd�gnknrrr�test_get_new_keys�sF



zKeysPageTest.test_get_new_keyscCs>tj}tdd�}t_|j}d|_|�|�d�d�|t_dS)NTr�zNew Keysr)rr�rrHr�r8rr�rrr�test_get_new_keys_name�sz#KeysPageTest.test_get_new_keys_namecCst|j}t�}|_|j�d�d|_|j��d|_d|_|�	|jt
jd�|j��|�|jt
jd�|`dS)NTrzmy new key setrr)
rHrrr	rTr�Zbutton_save_custom_keysr/r9r�r
rrc)r%r1rrrr�test_save_as_new_key_set�s

z%KeysPageTest.test_save_as_new_key_setcCs�|j}|j}|�dd�|�dd�|�dd�|�d�|��|�d�|��|�d�\}}}}||d7}||d7}|j	dddd�|j	d	||d�|j	d
||d�|j	d||d�|�
|�d�d�|�
|j�
�d
�dS)Nrrrr7�findr\r�rhr�rgrkrlr)rHrrrr5rarmrJrnrbr8rXrr�)r%r1r�rirjrorprrr�test_on_bindingslist_selects$

z(KeysPageTest.test_on_bindingslist_selectcCs|j}|j}|j�d�|j�d�d}d}|�|tj�|�|�|t�	dd�|g�|t�
d�t�
|��||j��|�|�
|j���||jjd�t�d|dd	�|�|tj�|�|�|t�	dd�||g�|�t�
|�t�
|��t�d|dd	�|t�
|�t�
|��dS)
NTrzmy new custom key setzmy second custom keysetr�rr7rr)r8rHr	rTr�r�r
rZcreate_new_key_setr��	GetKeySetr�rXrYrr9rr�rWr�r�rrr�,test_create_new_key_set_and_save_new_key_sets0

�
�z9KeysPageTest.test_create_new_key_set_and_save_new_key_setcCsV|j}|j}t�}t_|`|j}|�dd�|�dd�|�dd�ddgdgd	gd
�|_	t
�ddd
d�d}|�d�||�dd�|�||�d�d�||�
�d�|�d�|�d�|�d�||�dd�|�||�d�d�||�
�d�|�d�|�d�|�d�||�dd�|�||�d�d�||�
�d�t�|_t`dS)Nrrz<<find>>r7z<<help>>z<Control-Key-c>z<Control-Key-C>z<Control-Key-space>r)z<<copy>>z<<force-open-completions>>z<<spam>>rzmy keysr�z
<Shift-Key-a>)z&copy - <Control-Key-c> <Control-Key-C>�,force-open-completions - <Control-Key-space>�spam - <Shift-Key-a>rlrrr&)r7r\r')r\)r8rHrr
r$rrrrr�rr�rXZcurselectionrr)r%r�r1Zgksr�r{rrr�test_load_keys_list:s@�






z KeysPageTest.test_load_keys_listcCs2|j}|j}|j�d�t�}|_t�t_t�t_d}t	j
d�|dd�ddit|<d}t	j
d�|dd�dd	it|<|j
�d�|j
��|j�|�d
|_|j��||jd�|t|ddi�|t	�dd�||g�|tjjd
�|tjjd
�||jjd
�d|_|j��||jd�|�|t�|t	�dd�|g�||j
��d�||j��|�|tjjd�|tjjd�||jjd�|j�|�d|_|j��||jd�|�|t�|t	�dd�g�||j
��d�||j��d�|tjjd�|tjjd�||jjd�t`t`|`dS)Nr�zspam key setrr�r�r�r�z
other key setr�Fr7r�rTr\rrxr�r)r8rHrr�rr�rr3r'r
rr�r@r
r/r�rTr�r9r�rr�rX)r%r�r1rZkeyset_nameZkeyset_name2rrr�test_delete_custom_keyses\



z$KeysPageTest.test_delete_custom_keysN)r(r)r*r�r�rMrOrQrr
r�r�rrrr r!r#r%r(r)rrrrrs&


* 0
+rc@sdeZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)�WinPageTestz�Test that general tab widgets enable users to make changes.

    Test that widget actions set vars, that var changes add
    options to changes.
    cCs$tj}|_tj�|�|��dSr)rZwinpagerHr>r?rJrKrrrrM�szWinPageTest.setUpClasscCst��dSrrPr$rrrrQ�szWinPageTest.setUpcCsl|j}|j}|j�d�|j�d�|j�d�|��||j��d�||j��d�||j��d�dS)Nr7rZ80rs)r8rHZstartup_editrTZ	win_widthZ
win_heightZload_windows_cfgrXr�rrr�test_load_windows_cfg�sz!WinPageTest.test_load_windows_cfgcCsN|j}|j��|�tdddii�t��|j��|�tdddii�dS)N�Generalzeditor-on-startuprRr�)rHZstartup_editor_onr/r8rzrrZstartup_shell_onr:rrr�test_startup�s

�

�zWinPageTest.test_startupcCsr|j}|j�dd�|j�dd�|�tdddii�t��|j�dd�|j�dd�|�tdddii�dS)Nrr�11rvZheight�width)	rHZwin_height_intrrr8rzrrZ
win_width_intr:rrr�test_editor_size�szWinPageTest.test_editor_sizecCs<|j}|j�d�|�|j��d�|�tdddii�dS)N��6ZIndentz
num-spaces)rHZindent_chooserrTr8Z
indent_spacesrXrzr:rrr�test_indent_spaces�szWinPageTest.test_indent_spacescCs$|jj��|�tdddii�dS)Nrvzcursor-blinkr�)rHZcursor_blink_boolr/r8rzr$rrr�test_cursor_blink�szWinPageTest.test_cursor_blinkcCs8|jj�dd�|jj�dd�|�tdddii�dS)Nrrr.ZAutoCompleteZ	popupwait)rHZ
auto_wait_intrrr8r4r$rrr�test_autocomplete_wait�sz"WinPageTest.test_autocomplete_waitcCs�|j}|j}|jd�d�|tdddii�t��|j�dd�|j�	dd�|tdddii�t��|j
��|tdd	d
ii�dS)NZmenurZ
ParenMatchr�Zopenerrr.zflash-delayZbellr�)rHr8Zparen_style_typer/r4rrZparen_flash_timerrZbell_onr�rrr�test_parenmatch�s
zWinPageTest.test_parenmatchcCs8|jj�dd�|jj�dd�|�tdddii�dS)Nrrr.ZFormatParagraphz	max-width)rHZformat_width_intrrr8r4r$rrr�test_paragraph�szWinPageTest.test_paragraphN)r(r)r*r�r�rMrQr+r-r0r3r4r5r6r7rrrrr*�s



r*c@s<eZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dS)
�ShedPageTestz�Test that shed tab widgets enable users to make changes.

    Test that widget actions set vars, that var changes add
    options to changes.
    cCs$tj}|_tj�|�|��dSr)rZshedpagerHr>r?rJrKrrrrM�szShedPageTest.setUpClasscCst��dSrrPr$rrrrQ�szShedPageTest.setUpcCs4|j}|j}|j�d�|��||j��d�dS)Nr7r)r8rH�autosaverTZload_shelled_cfgrXr�rrr�test_load_shelled_cfgs
z"ShedPageTest.test_load_shelled_cfgcCsF|j}|j��|�tdddii�|j��|�tdddii�dS)Nr,r9rRr�)rHZsave_auto_onr/r8rzZsave_ask_onr:rrr�
test_autosave	s


zShedPageTest.test_autosavecCs8|jj�dd�|jj�dd�|�tdddii�dS)NrrrRZCodeContextZmaxlines)rHZcontext_intrrr8r4r$rrr�test_contextszShedPageTest.test_contextN)
r(r)r*r�r�rMrQr:r;r<rrrrr8�s
r8c@seZdZdZedd��ZdS)�ExtPageTest�/Test that the help source list works correctly.cCstj}tj�|�dSr)rr4r>r?rKrrrrMszExtPageTest.setUpClassN)r(r)r*r�r�rMrrrrr=sr=c@sheZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)�HelpSourceTestr>cCsFtj}tj�|�|j}|_t�|_|_t�|_	|_
|��dSr)rr4r>r?Z
frame_help�framerrT�set_add_delete_state�upc�update_help_changesrJ)rLrHr@rrrrM!szHelpSourceTest.setUpClasscCs2|j}|`|`|`|`|j�dd�|j��dS)Nrr)	r@rTrArBrC�helplistr�
user_helplistr)rLr@rrrrO*s
zHelpSourceTest.tearDownClasscCst��dSrrPr$rrrrQ2szHelpSourceTest.setUpcCsb|j}|j}|j�dd�ddg|_t�dddd�|��||j�dd�d	�||jd
g�dS)NrZbadZworser�	HelpFilesrRz	name;filer)r�)r��filerR)	r8r@rDrrEr
r�Z
load_helplistrX�r%r��frrrr�test_load_helplist5s
z!HelpSourceTest.test_load_helplistcCs�|j}|j|_|j|_|j}d}|�|d�|�|�|��|�	|�|�
�|�|�\}}}}||d7}||d7}d|j_|j_|j
dddd�|j
d||d�|j
d||d�|j
d	||d�|�|�d
�d�|�|jj�|�|jj�dS)Nr�sourcer\rr�rhr�rgrkrl)r@rArTrCrBrDrr5rarmrJrnr9rbr8rXrCrY)r%rIrDZdexrirjrorprrr�test_source_selected?s*

z#HelpSourceTest.test_source_selectedcCs�|j}|j}|`|j}|j}|�dd�|�||j��d�||j��d�|�dd�|�||j��d�||j��d�|�	d�|�||j��d�||j��d�t
�|_dS)Nrrr�rKr)r8r@rArDrZbutton_helplist_editr�Zbutton_helplist_removerrr)r%r�rIZsad�hrrr�test_set_add_delete_stateWs$
z(HelpSourceTest.test_set_add_delete_statecCs�|j}tj}tdd�}t_|j}|j�dd�|j��d|j	_
|j_
d|_|�
�|�t|j�dd��|jko~gkn�|�|jj
�d|_|�
�d|_|�
�||j�dd�d�||jddg�||jj
d	�|�|j	j
�|t_dS)
NTr�rrr��name1Zfile1�r�Zfile2)rPr�r\)r8r�
HelpSourcerr@rDrrErrTr9rBr�Zhelplist_item_addrC�listrXrY�r%r�Zorig_helpsourcer�rIrrr�test_helplist_item_addos0
��z%HelpSourceTest.test_helplist_item_addcCs*|j}tj}tdd�}t_|j}|j�dd�|j�dd�|j�d�|j�	d�|j
��|j
�d�d|j
_|j_d|_|��d|_|��||j�dd�d�||j
dg�|�|jj�d	|_|��||j�dd�d
�||j
d	g�|�|jj|j
jk�odkn�|t_dS)NTr�rrrPrOr)rPrQ)r�r7)r8rrRrr@rDrrrrrEr�appendrTr9rBr�Zhelplist_item_editrXrYrCrTrrr�test_helplist_item_edit�s0
(z&HelpSourceTest.test_helplist_item_editcCs�|j}|j}|j�dd�|j�dd�|j�d�|j�d�|j��|j�	d�d|j
_|j_|�
�||j�dd�d�||jg�|�|jj|j
jko�dkn�dS)NrrrPrOrr7)r8r@rDrrrrrErrVrTr9rBZhelplist_item_removerXrCrHrrr�test_helplist_item_remove�s
z(HelpSourceTest.test_helplist_item_removecCsV|j}|`|j��|j�d�|j�d�|��|�tdddd��t�|_dS)NrOrQrFzname1;file1zname2;file2)rR�2)r@rCrErrVr8rzr)r%rIrrr�test_update_help_changes�s

�z'HelpSourceTest.test_update_help_changesN)r(r)r*r�r�rMrOrQrJrLrNrUrWrXrZrrrrr?s


r?c@sdeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�VarTraceTestcCs"t��|_tt�|_tt�|_dSr)rZVarTracerrr�ivr	�bvrNrrrrM�s

zVarTraceTest.setUpClasscCs|`|`|`dSr)rr\r]rNrrrrO�szVarTraceTest.tearDownClasscCs|j��d|_dSr�)rrr9r$rrrrQ�s
zVarTraceTest.setUpcGs|jd7_dS)N�
)r9�r%�paramsrrr�var_changed_increment�sz"VarTraceTest.var_changed_incrementcGsdSrrr_rrr�var_changed_boolean�sz VarTraceTest.var_changed_booleancCs.|j}|��|�|jg�|�|jg�dSr)r�__init__r8�untraced�traced�r%�trrrr�	test_init�szVarTraceTest.test_initcCsF|j}|j�d�|j�d�|��|�|jg�|�|jg�dS)Nrr7)rrdrVrerr8rfrrr�
test_clear�szVarTraceTest.test_clearc	Cs�|j}t�}tj|d�}|_|�|j|j�}|�||j�|�|j	|j
�}|�||j	�tt�}|�|d�}|�||�|�
�|�|d�||jf||j
f||fg}|�|jg�|�|j|�|`dS)Nr��rr�r�)rrrr,�
make_callback�addr\raZassertIsr]rbrrr0Zassert_called_withr8rerd)	r%rg�func�cbr\r]ZsvZsv2r{rrr�test_add�s&�zVarTraceTest.test_addcCst|j�|jd�}|�t|��|j�d�|�dtd�|�|�dtd�|�	tdddd�t�
�dS)Nrj�*r�rr�Z42)rrkr\rC�callablerTr�rrcr8r)r%rnrrr�test_make_callbackszVarTraceTest.test_make_callbackcCs�|j}|�|j|j�}|�|j|j�}||jf||jfg}|��|�|jg�|�	|j
|�|�d�|�|��d�|�|j
d�d|_
|��|�d�|�|j
d�d|_
|��|�|j
g�|�	|j|�|�d�|�|j
d�dS)Nr7r^r)rrlr\rar]rbrZr8rdZassertCountEqualrerTrXr9r)r%rgr\r]r{rrr�test_attach_detachs,�


zVarTraceTest.test_attach_detachN)r(r)r*r�rMrOrQrarbrhrirorrrsrrrrr[�s

r[�__main__r\)�	verbosity).r�ZidlelibrZtest.supportrZunittestrZidlelib.idle_test.mock_idlerZtkinterrrrr	r
rrZidlelib.configdialogr
rrrrZIdleUserConfParserrrrrzr�r@r4rr"ZTestCaser#r+rGr�rr*r8r=r?r[r(rrrrr�<module>sX �	+Q%(h