Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/tkinter/test/test_ttk/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/tkinter/test/test_ttk/__pycache__/test_widgets.cpython-35.pyc



��Yf!��@s4ddlZddlZddlmZmZddlmZddlZddlmZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZmZed�Gdd	�d	e�ZGd
d�de
ej�ZGdd
�d
ee�Zee�Gdd�deej��Zee�Gdd�deej��ZGdd�de�Zee�Gdd�deej��Zee�Gdd�deej��Zee�Gdd�deej��Zeee�Gdd�deej��Z eee�Gdd�de ej��Z!eee�Gdd�deej��Z"ee�Gd d!�d!eej��Z#Gd"d#�d#eej�Z$ee�Gd$d%�d%eej��Z%ee�Gd&d'�d'eej��Z&ej'ej(d(kd)�ee�Gd*d+�d+eej���Z)eee�Gd,d-�d-eej��Z*ee�Gd.d/�d/eej��Z+ee�Gd0d1�d1eej��Z,ee�Gd2d3�d3eej��Z-eee!e eeee$e*e"e&e#e%e)e,e-e+efZ.e/d4kr0ej0�dS)5�N)�ttk�TclError)�requires)�
MockTclObj)�AbstractTkTest�tcl_version�get_tk_patchlevel�simulate_mouse_click)�add_standard_options�noconv�AbstractWidgetTest�StandardOptionsTests�IntegerSizeTests�PixelSizeTests�setUpModuleZguic@s4eZdZdd�Zdd�Zdd�ZdS)�StandardTtkOptionsTestscCs~|j�}|j|dd�d}t�d
kr;d	}|j|dd
d|�|jdd
�}|j|dd
�dS)N�class�z"attempt to change read-only option��r�beta�z"Attempt to change read-only option�Foo�errmsg�class_)rrrrr)�create�assertEqualr�checkInvalidParam)�self�widgetr�widget2�r!�G/opt/alt/python35/lib64/python3.5/tkinter/test/test_ttk/test_widgets.py�
test_classsz"StandardTtkOptionsTests.test_classc	Cs�|j�}|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dddd�|j|dd�|j|dfdd�dS)N�paddingr�expected�0��5r�6��7r�8�5p�6p�7p�8pr)r&)r()r'r)r(r))r'rr*)r(r)r+)r'rr*r)r(r)r+r,)r-r.r/r0)r�
checkParam)rrr!r!r"�test_paddingsz$StandardTtkOptionsTests.test_paddingcCs�|j�}|j|dd�d}t|d�rNdt|d�j�}|j|ddd|�|jdd�}|j|d	d�dS)
N�stylerzLayout Foo not found�default_orientzLayout %s.Foo not foundrrrr)rr�hasattr�getattr�titler)rrrr r!r!r"�
test_style)sz"StandardTtkOptionsTests.test_styleN)�__name__�
__module__�__qualname__r#r2r8r!r!r!r"rs
rcs@eZdZdZ�fdd�Zdd�Zdd�Z�S)�
WidgetTestz,Tests methods available in every ttk widget.csLt�j�tj|jdddd�|_|jj�|jj�dS)N�widthr�textZText)�super�setUpr�Button�rootr�pack�wait_visibility)r)�	__class__r!r"r@;s
!
zWidgetTest.setUpcCs�|jj�|j|jjt|jj�d�t|jj�d��d�|j|jjdd�d�|jtj	|jjdd�|jtj	|jjdd�|jtj	|jjdd�dS)N��label�rr'���rI)
r�update_idletasksr�identify�int�winfo_width�winfo_height�assertRaises�tkinterr)rr!r!r"�
test_identifyBs
zWidgetTest.test_identifycCs�|j|jj�f�|j|jjdg�d�|j|jjdg�d�|j|jjdg�f�|j|jjddg�d
�|j|jjddg�f�|j|jjddg�f�dd�}|j|jjdg|dd	d
i�dd	d
if�|jj�}|jtj|jjdg�|jtj|jjddg�|j||jj��|jjddg�|j|jj�d�dS)N�	!disabledT�disabled�active�!activec[s
||fS)Nr!)Zarg1�kwr!r!r"�test_cb_sz-WidgetTest.test_widget_state.<locals>.test_cb�hi�msgZthereZbadstate)rR)rUrS)rT)rr�stateZinstaterOrPr)rrWZ	currstater!r!r"�test_widget_stateOs(""

zWidgetTest.test_widget_state)r9r:r;�__doc__r@rQr[r!r!)rEr"r<8s
r<c@seZdZeZdS)�AbstractToplevelTestN)r9r:r;r�_conv_pixelsr!r!r!r"r]ssr]c	@s"eZdZd
Zd
d�ZdS)�	FrameTest�borderwidthr�cursor�heightr$�reliefr3�	takefocusr=cKstj|j|�S)N)rZFramerB)r�kwargsr!r!r"rszFrameTest.createN)	r`rrarbr$rcr3rdr=)r9r:r;�OPTIONSrr!r!r!r"r_wsr_c
@s:eZdZdZdd�Zdd�Zdd�ZdS)�LabelFrameTestr`rrarb�labelanchor�labelwidgetr$rcr3rdr>�	underliner=cKstj|j|�S)N)rZ
LabelFramerB)rrer!r!r"r�szLabelFrameTest.createcCs]|j�}|j|ddddddddd	d
ddd
dd�|j|dd�dS)Nrh�eZenZes�n�neZnw�sZseZsw�wZwnZwsrz!Bad label anchor specification {}�center)r�checkEnumParamr)rrr!r!r"�test_labelanchor�s
'zLabelFrameTest.test_labelanchorcCsQ|j�}tj|jdddd�}|j|d|dd�|j�dS)Nr>ZMupp�nameZfoorir%z.foo)rr�LabelrBr1�destroy)rrrGr!r!r"�test_labelwidget�szLabelFrameTest.test_labelwidgetN)
r`rrarbrhrir$rcr3rdr>rjr=)r9r:r;rfrrrrvr!r!r!r"rg�srgc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�AbstractLabelTestcCs�tjd|jdd�}tjd|jdd�}|j|||dd�|j||ddd�|j|||fdd
�|j|||d|fdd�|j||ddd�|j||dd	d
�dS)N�masterrs�image1�image2r%rTzimage1 active image2Zspamrzimage "spam" doesn't exist)ry)ry)ry)ryrTrz)ryrTrz)rPZ
PhotoImagerBr1r)rrrs�imagerzr!r!r"�checkImageParam�sz!AbstractLabelTest.checkImageParamcCs8|j�}|j|ddddddddd	�
dS)
N�compound�noner>r{rp�topZbottom�left�right)rrq)rrr!r!r"�
test_compound�szAbstractLabelTest.test_compoundcCs)|j�}|j|dddd�dS)NrZrTrS�normal)r�checkParams)rrr!r!r"�
test_state�szAbstractLabelTest.test_statecCs)|j�}|j|dddd�dS)Nr=i�rin���)rr�)rrr!r!r"�
test_width�szAbstractLabelTest.test_widthN)r9r:r;r|r�r�r�r!r!r!r"rw�s
rwc@s4eZdZdZeZdd�Zdd�ZdS)�	LabelTest�anchor�
backgroundr`rr}ra�font�
foregroundr{�justifyr$rcrZr3rdr>�textvariablerjr=�
wraplengthcKstj|j|�S)N)rrtrB)rrer!r!r"r�szLabelTest.createcCs#|j�}|j|dd�dS)Nr�z3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*)rr1)rrr!r!r"�	test_font�szLabelTest.test_fontN)r�r�r`rr}rar�r�r{r�r$rcrZr3rdr>r�rjr=r�)r9r:r;rfrr^rr�r!r!r!r"r��sr�c@s:eZdZdZdd�Zdd�Zdd�ZdS)�
ButtonTestr�commandr}ra�defaultr{r$rZr3rdr>r�rjr=cKstj|j|�S)N)rrArB)rrer!r!r"r�szButtonTest.createcCs)|j�}|j|dddd�dS)Nr�r�rTrS)rrq)rrr!r!r"�test_default�szButtonTest.test_defaultcsEg�tj|jd�fdd��}|j�|j��dS)Nr�cs
�jd�S)NrH)�appendr!)�successr!r"�<lambda>�sz(ButtonTest.test_invoke.<locals>.<lambda>)rrArB�invoke�
assertTrue)rZbtnr!)r�r"�test_invoke�s$
zButtonTest.test_invokeN)rr�r}rar�r{r$rZr3rdr>r�rjr=)r9r:r;rfrr�r�r!r!r!r"r��sr�c@sFeZdZdZdd�Zdd�Zdd�Zdd�ZdS)�CheckbuttonTestrr�r}rar{�offvalue�onvaluer$rZr3rdr>r�rj�variabler=cKstj|j|�S)N)r�CheckbuttonrB)rrer!r!r"r�szCheckbuttonTest.createcCs,|j�}|j|ddddd�dS)Nr�rHgffffff@rz
any string)rr�)rrr!r!r"�
test_offvalue�szCheckbuttonTest.test_offvaluecCs,|j�}|j|ddddd�dS)Nr�rHgffffff@rz
any string)rr�)rrr!r!r"�test_onvalue�szCheckbuttonTest.test_onvaluecsg��fdd�}tj|jd|�}|j|j�d�|jtj|jj	|d�|j
�}|j|d�|j|d|jj	|d��|j��d|d<|j
�}|jt
|��|jt��d	�|j|d
|jj	|d��dS)Ncs�jd�dS)NrHzcb test called)r�r!)r�r!r"�cb_test�s
z,CheckbuttonTest.test_invoke.<locals>.cb_testr��	alternater�zcb test calledr�rrHr�)r�)rr�rBrrZrOrPr�tk�globalgetvarr�r��assertFalse�str�assertLessEqual�len)rr��cbtn�resr!)r�r"r��s"



zCheckbuttonTest.test_invokeN)rr�r}rar{r�r�r$rZr3rdr>r�rjr�r=)r9r:r;rfrr�r�r�r!r!r!r"r��sr�cs�eZdZd*Z�fdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
d d!�Zd"d#�Zd$d%�Z
d&d'�Zd(d)�Z�S)+�	EntryTestr�rra�exportselectionr�r��invalidcommandr��showrZr3rdr��validate�validatecommandr=�xscrollcommandcs t�j�|j�|_dS)N)r?r@r�entry)r)rEr!r"r@!s
zEntryTest.setUpcKstj|j|�S)N)rZEntryrB)rrer!r!r"r%szEntryTest.createcCs |j�}|j|d�dS)Nr�)r�checkCommandParam)rrr!r!r"�test_invalidcommand(szEntryTest.test_invalidcommandcCsI|j�}|j|dd�|j|dd�|j|dd�dS)Nr��*r� )rr1)rrr!r!r"�	test_show,szEntryTest.test_showcCs)|j�}|j|dddd�dS)NrZrSr��readonly)rr�)rrr!r!r"r�2szEntryTest.test_statec	Cs2|j�}|j|ddddddd�dS)Nr��all�key�focusZfocusinZfocusoutr~)rrq)rrr!r!r"�
test_validate7szEntryTest.test_validatecCs |j�}|j|d�dS)Nr�)rr�)rrr!r!r"�test_validatecommand<szEntryTest.test_validatecommandcCsU|j|jjd��|jtj|jjd�|jtj|jjd�dS)NrZnoindex)�assertIsBoundingBoxr��bboxrOrPr)rr!r!r"�	test_bboxAszEntryTest.test_bboxcCs�|jj�|jj�|jj�|j|jjdd�d�|j|jjdd�d�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS)Nr'ZtextarearHrrIrI)	r�rCrDrJrrKrOrPr)rr!r!r"rQGs


zEntryTest.test_identifycs,g��fdd�}d|jd<dd�|jd<||jd<|jj�|j��d|jd<|jj�|jt��d	�||jd<d
d�|jd<|jj�|jt��d	�d|jd<|jj�|jt��d	�d|jd<|jtj|jj�dS)Ncs
�jd�S)NT)r�r!)r�r!r"r�Vsz3EntryTest.test_validation_options.<locals>.<lambda>r~r�cSsdS)NFr!r!r!r!r"r�Ysr�r�rrHcSsdS)NTr!r!r!r!r"r�dsT)r�r�r�rr�rOrPr)rZtest_invalidr!)r�r"�test_validation_optionsTs&










z!EntryTest.test_validation_optionscs�g��fdd�}d|jd<|jj|�df|jd<|jjdd�|jjdd	�|j�d
dg�|j|jj�d	�dS)NcsDd|j�kodkns3�jd�dS�jd�dS)N�a�zFT)�lowerr�)Z	to_insert)�
validationr!r"r�rs
"

z+EntryTest.test_validation.<locals>.validater�r�z%Sr��endrHr�FT)r��register�insertr�get)rr�r!)r�r"�test_validationps
zEntryTest.test_validationcCs'dd�}|jj|�df|jd<|jjdd�|j|jj�d�|j|jj�f�|jjdd�|j|jj�d	�|jjdd
�|j|jj�d�|j|jj�d�|jjd
�|j|jj�d�|j|jj�f�dS)NcSs;x4|D],}d|j�ko*dknsdSqWdS)Nr�r�FT)r�)ZcontentZletterr!r!r"r��s
"z-EntryTest.test_revalidation.<locals>.validatez%Pr�r�ZavocadoTrrZa1bF�invalidrH)r�)r�r�r�rr�rZ�deleter�)rr�r!r!r"�test_revalidation�szEntryTest.test_revalidation)r�rrar�r�r�r�r�r�rZr3rdr�r�r�r=r�)r9r:r;rfr@rr�r�r�r�r�r�rQr�r�r�r!r!)rEr"r�s"
r�cspeZdZd#Z�fdd�Zdd�Zdd�Zdd�Zdd�Zdd �Z	d!d"�Z
�S)$�ComboboxTestr�rrar�r�r�rbr�r��postcommandr�rZr3rdr�r�r��valuesr=r�cs t�j�|j�|_dS)N)r?r@r�combo)r)rEr!r"r@�s
zComboboxTest.setUpcKstj|j|�S)N)r�ComboboxrB)rrer!r!r"r�szComboboxTest.createc	Cs2|j�}|j|ddddddd�dS)Nrb�dg�����LY@gfffff�Y@rZ1ii����)rr�)rrr!r!r"�test_height�szComboboxTest.test_heightcCs`|jj�}|jjdd|ddd�|jjdd|ddd�|jj�dS)Nz<ButtonPress-1>�xr'�yz<ButtonRelease-1>)r�rM�event_generaterJ)rr=r!r!r"�_show_drop_down_listbox�s  z$ComboboxTest._show_drop_down_listboxcs�g�dg|jd<|jjd�fdd��|jj�|jj�|jj�}|j�|jj�|jjd�|jj�|j��dS)NrHr�z<<ComboboxSelected>>cs
�jd�S)NT)r�)�evt)r�r!r"r��sz1ComboboxTest.test_virtual_event.<locals>.<lambda>z<Return>)	r��bindrCrDrNr��updater�r�)rrbr!)r�r"�test_virtual_event�s




zComboboxTest.test_virtual_eventcs�g��fdd�|jd<|jj�|jj�|j�|j��d|jd<|j�|jt��d�dS)Ncs
�jd�S)NT)r�r!)r�r!r"r��sz/ComboboxTest.test_postcommand.<locals>.<lambda>r�rrH)r�rCrDr�r�rr�)rr!)r�r"�test_postcommand�s





zComboboxTest.test_postcommandc	s��fdd�}�j�jdtd$kr4fnd�|dd%��j�jddd	d&��j�jdd'��j�jdd(��j�jddd	t�d)kr�dnf�dddg�jd<�jjd�|dd��jjd�|dd��jjd�|dd*��jjd�d+�jd<|dd��jjddddg��j�jd�jr�d,nd�dddg�jd<�j�jd�jr�d-nd�dd d!g�jd<�j�jd�jrd.nd"��j	t
j�jjt�jd���j	t
j�jjd�t
j�jddddg�}�j|d�jr�d/nd#�|j�dS)0Ncs6�j�jj�|��j�jj�|�dS)N)rr�r��current)ZgetvalZcurrval)rr!r"�check_get_current�sz3ComboboxTest.test_values.<locals>.check_get_currentr�rr'rrHzmon tue wed thurr%�mon�tue�wed�thur�*���Q�	@�
any string�
r��crFr�dr�1�2z1 {} 2�a b�a	b�a
bz{a b} {a	b} {a
b}�a\tb�"a"�} {za\\tb {"a"} \}\ \{z1 2 {})rr'rI)r�r�r�r�)r�r�r�r�)r�r�rr�)rr'r�rI)rHrFrr)r�rr�)r�r�r�)r�r�r�)r�r�r)rr�rr1r�setr��	configure�wantobjectsrOrPrr�rr�rBru)rr�Zcombo2r!)rr"�test_values�sN





!
zComboboxTest.test_values)r�rrar�r�r�rbr�r�r�r�rZr3rdr�r�r�r�r=r�)r9r:r;rfr@rr�r�r�r�r�r!r!)rEr"r��sr�cs|eZdZdZ�fdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Z�S)�PanedWindowTestrrarb�orientr3rdr=cs t�j�|j�|_dS)N)r?r@r�paned)r)rEr!r"r@ s
zPanedWindowTest.setUpcKstj|j|�S)N)rZPanedWindowrB)rrer!r!r"r$szPanedWindowTest.createcCs�|j�}|jt|d�d�d}t�dkrAd	}|j|dd
d|�|jdd
�}|jt|d�d
�dS)
Nr��verticalz"attempt to change read-only optionrrrrrz"Attempt to change read-only option�
horizontalr)rrrrr)rrr�rr)rrrr r!r!r"�test_orient'szPanedWindowTest.test_orientcCsztj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}tj|�}|jtj|jj|�|j�|j�tj|j�}|jj|�|jtj|jj|�tj|j�}|jj|�|j	|jj
d�|jj
d��|jtj|jj
d�|j�|j�|jtj|jj
d�dS)NrrHrF)rrtr�rOrPr�addrurBr�pane)rrG�childZ
good_childZother_childr!r!r"�test_add2s(



(

zPanedWindowTest.test_addcCs�|jtj|jjd�|jtj|jjd�|jjtj|j��|jjd�|jtj|jjd�dS)Nr)	rOrPrr��forgetr�rrtrB)rr!r!r"�test_forgetNs
zPanedWindowTest.test_forgetcCs|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�tj|j�}tj|j�}tj|j�}|jtj|jjd|�|jjd|�|jjd|�|j|jj	�t
|�t
|�f�|jjd|�|j|jj	�t
|�t
|�f�|jjd|�|j|jj	�t
|�t
|�t
|�f�|jj	�}|jjd|�|j||jj	��|jj||�|j|jj	�t
|�t
|�t
|�f�dS)Nrr�)rOrPrr�r�rrtrBr�panesr�)rr��child2�child3rr!r!r"�test_insertWs*++"zPanedWindowTest.test_insertcCs
|jtj|jjd�tj|j�}|jj|�|j	|jjd�t
�|j|jjddd�|jr�dnd�|j|jjdd�|jr�dnd�|j|jjd�|jjt
|���|jtj|jjddd�dS)Nr�weightr&Z	badoptionZ	somevalue)rOrPrr�r�rrtrBr��assertIsInstance�dictrr�r�)rr�r!r!r"�	test_panezs.zPanedWindowTest.test_panecCsi|jtj|jjd�|jtj|jjd�|jtj|jjd�tj|jdd�}|jj|dd�|jtj|jjd�tj|jdd�}|jj|�|jtj|jjd�|jjdd	d
d�|jj	�|jjd�}|jjdd�|j
||jjd��|j|jjd�t�dS)
Nrrr>r�rrH�b�expandTZfillZbothi�)
rOrPrr�Zsashposrrtr�rCrD�assertNotEqualrrL)rr�rZcurr_posr!r!r"�test_sashpos�s
zPanedWindowTest.test_sashpos)rrarbr�r3rdr=)r9r:r;rfr@rr�r�rrr	r
r!r!)rEr"r�s	#r�c@s:eZdZdZdd�Zdd�Zdd�ZdS)�RadiobuttonTestrr�r}rar{r$rZr3rdr>r�rj�valuer�r=cKstj|j|�S)N)r�RadiobuttonrB)rrer!r!r"r�szRadiobuttonTest.createcCs,|j�}|j|ddddd�dS)NrrHgffffff@rz
any string)rr�)rrr!r!r"�
test_value�szRadiobuttonTest.test_valuecs�g��fdd�}tj|j�}tj|jd|d|dd�}tj|jd|d|dd�}|jr�dd	�}nt}|j�}|j|d
�|j||d�|j	��|j|j	�||j
j|d���|j��d|d<|j�}|jt
|�d�|jt��d�|j||d�|j	��|j|j	�||j
j|d���|jt
|d�t
|d��dS)Ncs�jd�dS)NrHzcb test called)r�r!)r�r!r"r��s
z,RadiobuttonTest.test_invoke.<locals>.cb_testr�r�rrrHcSs|S)Nr!)r�r!r!r"r��sz-RadiobuttonTest.test_invoke.<locals>.<lambda>zcb test calledr)rPZIntVarrBrrr�rLr�rr�r�r�r�r�r�r�)rr�Zmyvarr�Zcbtn2�convr�r!)r�r"r��s0	 

 zRadiobuttonTest.test_invokeN)rr�r}rar{r$rZr3rdr>r�rjrr�r=)r9r:r;rfrrr�r!r!r!r"r�src@s:eZdZdZdd�Zdd�Zdd�ZdS)�MenubuttonTestrr}ra�	directionr{�menur$rZr3rdr>r�rjr=cKstj|j|�S)N)rZ
MenubuttonrB)rrer!r!r"r�szMenubuttonTest.createcCs/|j�}|j|dddddd�dS)NrZaboveZbelowr�r��flush)rrq)rrr!r!r"�test_direction�szMenubuttonTest.test_directioncCsH|j�}tj|dd�}|j|d|dt�|j�dS)Nrsrr)rrPZMenur1r�ru)rrrr!r!r"�	test_menu�szMenubuttonTest.test_menuN)rr}rarr{rr$rZr3rdr>r�rjr=)r9r:r;rfrrrr!r!r!r"r�srcs�eZdZdZeZdZ�fd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Z�S) �	ScaleTestrr�ra�from�lengthr�r3rd�torr�r�cs:t�j�|j�|_|jj�|jj�dS)N)r?r@r�scalerCr�)r)rEr!r"r@�s

zScaleTest.setUpcKstj|j|�S)N)rZScalerB)rrer!r!r"r�szScaleTest.createcCs/|j�}|j|dddddd�dS)Nrr�g������-@g333333.@rF)r�checkFloatParam)rrr!r!r"�	test_from�szScaleTest.test_fromcCs,|j�}|j|ddddd�dS)Nr�gffffff`@g33333�`@Z5i)r�checkPixelsParam)rrr!r!r"�test_lengthszScaleTest.test_lengthc	Cs2|j�}|j|ddddddd�dS)	Nri,g������-@g333333.@r�rFi����)rr)rrr!r!r"�test_toszScaleTest.test_toc	Cs2|j�}|j|ddddddd�dS)	Nri,g������-@g333333.@r�rFi����)rr)rrr!r!r"r	szScaleTest.test_valuecs�dddg�|jjd�fdd��}d|jd<d|jd<d|jd	<|j��dddg�|jjdd
d	d�|jjddd	d
�|jjd	d�|j��dS)NrHz<<RangeChanged>>cs
�j�S)N)�pop)r�)�failurer!r"r�sz-ScaleTest.test_custom_event.<locals>.<lambda>r�rZfrom_rrrFr'r���)rr�r�r�)rZfuncidr!)r%r"�test_custom_event
s!



zScaleTest.test_custom_eventcCs|jrdd�}nt}|jj�}|j|jj|d�|jd�|j||jjdd��||jd��|j|jj�|jd�d|jd<|j|jj�|jd�|jtj|jjdd�|jtj|jjdd�dS)	NcSs|S)Nr!)r�r!r!r"r�"sz$ScaleTest.test_get.<locals>.<lambda>rrrr�r)	r��floatrrMrr�rOrPr)rrZscale_widthr!r!r"�test_get s	&2 
 zScaleTest.test_getcCs�|jrdd�}nt}||jd�}|d}|jj|�|j||jj��|�||jd�}|jj|d�|j||jj��|�tj|j�}||jd<|j|d�|j||jj��|j��|j||jj��|d�~|d|jd	<|j||jj��|d�|j||jj��||jd	��|j||jjd
d
��|�|j||jj|jj	�d
��|�|j
tj|jjd�dS)NcSs|S)Nr!)r�r!r!r"r�4sz$ScaleTest.test_set.<locals>.<lambda>rr�rrHr�r'rr)r�r)rr�rr�rPZ	DoubleVarrBrMrOr)rr�maxZnew_max�min�varr!r!r"�test_set2s,	

%##,%.zScaleTest.test_set)rr�rarrr�r3rdrrr�)r9r:r;rfrr^r4r@rrr"r#rr'r*r.r!r!)rEr"r�src@sjeZdZdZeZdZd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�ZdS)�ProgressbarTestrrar�r�mode�maximum�phaser3rdrr�r�cKstj|j|�S)N)rZProgressbarrB)rrer!r!r"r`szProgressbarTest.createcCs)|j�}|j|dddd�dS)NrgfffffY@g�����YL@Z2i)rr!)rrr!r!r"r"cszProgressbarTest.test_lengthc	Cs2|j�}|j|ddddddd�dS)	Nr1gfffff�b@g�����lS@rr�rFi����)rr)rrr!r!r"�test_maximumgszProgressbarTest.test_maximumcCs&|j�}|j|ddd�dS)Nr0ZdeterminateZ
indeterminate)rrq)rrr!r!r"�	test_modekszProgressbarTest.test_modecCsdS)Nr!)rr!r!r"�
test_phaseoszProgressbarTest.test_phasec	Cs2|j�}|j|ddddddd�dS)	Nrgfffff�b@g�����lS@rr�rFi����)rr)rrr!r!r"rsszProgressbarTest.test_valueN)rrar�rr0r1r2r3rdrr�)
r9r:r;rfrr^r4rr"r3r4r5rr!r!r!r"r/Vsr/�darwinz"ttk.Scrollbar is special on MacOSXc@s(eZdZdZdZdd	�Zd
S)�
ScrollbarTestrr�rar�r3rdr�cKstj|j|�S)N)rZ	ScrollbarrB)rrer!r!r"r�szScrollbarTest.createN)rr�rar�r3rd)r9r:r;rfr4rr!r!r!r"r7ysr7cs�eZdZdZ�fdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Z�S)�NotebookTestrrarbr$r3rdr=cs�t�j�|jdd�|_tj|j�|_tj|j�|_|jj	|jdd�|jj	|jdd�dS)Nr$rr>r�r
)
r?r@r�nbrrtrB�child1rr�)r)rEr!r"r@�s
zNotebookTest.setUpcKstj|j|�S)N)rZNotebookrB)rrer!r!r"r�szNotebookTest.createcCs�|jjd�|jj|j�|jtj|jj|j�|j	|jj
d�d�|jj|j�|j	|jj
d�d�|jj|j�|j
|jjd��|jj|jdd�|jj�|jj�tjdkrd}nd	}|j	|jj|�|jjd��xftd
dd
�D]E}y'|jjd|dd�dkrqPWqEtjk
r�YqEXqEW|jd
�dS)Nrr�rHr�r>r�r6z@20,5z@5,5r'r�z@%d, 5zTab with text 'a' not found)r9r�hiderrOrPr�tabr:r�indexr��selectr�rCrD�sys�platform�range�fail)rZtb_idx�ir!r!r"�test_tab_identifiers�s,

	("	z!NotebookTest.test_tab_identifierscCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjtj|j�dd�|jj	�}|jj|j
�|jj|j
�|j|jj	�|�tj|j�}|jj|dd�|jj	�}|jjd�}|jj|j
�}|jj|j
�|jj|j
�|j|jj	�|�|j|jj|j
�|�|jt|j
�|jj	�|�|j|jjd�|d�dS)	NrHrX�unknownZoptionr>r�r�rI)rOrPrr9r;r�rrtrB�tabsr:rr=rr�)rrFr�ZcurrZchild2_indexr!r!r"�test_add_and_hidden�s*'&z NotebookTest.test_add_and_hiddencCs+|jtj|jjd�|jtj|jjd�|jtj|jjd�|jj�}|jj|j�}|jj|j�|jt	|j�|jj��|j
t|�dt|jj���|jj|j�|j
|jj|j�d�|j
||jj|j��dS)NrHrXrI)rOrPrr9rrFr=r:ZassertNotInr�rr�r�r)rrFZchild1_indexr!r!r"r�s")zNotebookTest.test_forgetcCs�|jtj|jjd�|jtj|jjd�|j|jjd�t�|j|jj|j�d�|j|jj|j	�d�|j|jjd�d�dS)NrHr�rrFrI)
rOrPrr9r=rrLrr:r)rr!r!r"�
test_index�szNotebookTest.test_indexcCs�|jj�}|jjd|d�|j|jj�|d|df�|jj|j|j�|j|jj�|�|jjd|j�|j|jj�|d|df�|jjdd�|j|jj�|�|jtj|jjd|d�|jtj|jjd|d�t	j
|j�}|jjd|�|j|jj�|dt|�|df�|jj
|�|j|jj�|�|jj|j|�|j|jj�t|�f|�|jj
|�|jtj|jjd|�|jtj|jjd|�|jtj|jjdd�|jtj|jjdd�|jtj|jjdd�dS)NrHrr�rFrIrI)r9rFr�rr:rrOrPrrrtrBr�r)rrFrr!r!r"r�s0''##0&zNotebookTest.test_insertcs�|jj�|jj�g�g�|jjd�fdd��|jjd�fdd��|j|jj�t|j��|jj|j�|j	��|j|jj�t|j��|jj
�|j	��dS)Nz<Unmap>cs
�jd�S)NT)r�)r�)r�r!r"r�sz*NotebookTest.test_select.<locals>.<lambda>z<<NotebookTabChanged>>cs
�jd�S)NT)r�)r�)�tab_changedr!r"r�s)r9rCrDr:r�rr>r�rr�r�)rr!)r�rIr"�test_selects

"
"
zNotebookTest.test_selectcCs|jtj|jjd�|jtj|jjd�|jtj|jjd�|j|jj|j�t�|j|jj|jdd�d�|j|jj|jd�d�|jj|jdd�|j|jj|jdd�d�|j|jj|jd�d�dS)NrHZnotabr>r��abcrI)	rOrPrr9r<rr:rr)rr!r!r"�test_tab"s%"%zNotebookTest.test_tabcCsb|jt|jj��d�|jj|j�|jj|j�|j|jj�f�dS)NrF)rr�r9rFrr:r)rr!r!r"�	test_tabs0szNotebookTest.test_tabscCs�|jj�|jj�|jjd�t|jdd�|jj�|jjd�|j|jj�t|j	��|jj�|jjd�|j|jj�t|j
��|jj�|jjd�|j|jj�t|j	��|jj|j
dddd�|jj�|jj�t|jdd�t
jdkrh|jjd	�n|jjd
�|j|jj�t|j
��dS)Nrr'z
<Control-Tab>z<Shift-Control-Tab>r>r�rjr6z
<Option-a>z<Alt-a>)r9rCrDr>r	Zfocus_forcer�rr�rr:r<Zenable_traversalr?r@)rr!r!r"�test_traversal9s*


"
"
"

zNotebookTest.test_traversal)rrarbr$r3rdr=)r9r:r;rfr@rrDrGrrHrrJrLrMrNr!r!)rEr"r8�s
!	r8cs0eZdZd;Z�fd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd �Z
d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z�S)<�TreeviewTestr�columnsra�displaycolumnsrbr$�
selectmoder�r3rdr��yscrollcommandcs&t�j�|jdd�|_dS)Nr$r)r?r@r�tv)r)rEr!r"r@]s
zTreeviewTest.setUpcKstj|j|�S)N)rZTreeviewrB)rrer!r!r"raszTreeviewTest.createc	Csj|j�}|j|dddd�|j|dd�|j|dfdt�d
kr_d
nf�dS)NrPza b cr%r�r
r�rr'r�r)r�r
r�)r�r
r�)rr'r�)rr1r)rrr!r!r"�test_columnsdszTreeviewTest.test_columnscCs�|j�}d|d<|j|dddd�|j|dd�|j|dddd�|j|dd�|j|ddd
d�|j|ddd
d�|j|ddd
d�dS)Nr�r
r�rPrQzb a cr%�#allrFrHrr�rzInvalid column index drzColumn index 3 out of boundszColumn index -2 out of bounds)r�r
r�)r
r�r�)r
r�r�)rV)rFrHr)r�r
r�)rHrFrr&)rHr&)rr1r)rrr!r!r"�test_displaycolumnsls
z TreeviewTest.test_displaycolumnsc	CsN|j�}|j|ddd	dddd�|j|ddddt�dS)
Nrbr�rZ3crFg�����LY@gfffff�Y@i����)rr!r)rrr!r!r"r�|s"zTreeviewTest.test_heightcCs)|j�}|j|dddd�dS)NrRr~ZbrowseZextended)rrq)rrr!r!r"�test_selectmode�szTreeviewTest.test_selectmodecCs�|j�}|j|dddd�|j|dd�|j|dd�|j|dddd	�|j|dddd
�dS)Nr�z
tree headingsr%�tree�headings)rYrZ)rYrZ)rZrY)rY)rZ)rr1)rrr!r!r"r��szTreeviewTest.test_showcCsT|jj�|j|jjd�d�|jj�|jj�|jjdd�}|jj�}|j|�|jj|d�}|j	|�dg|jd<|jj
ddd�|jj|dd�}|jj
ddd�}|jst|�}|j|d|d|�|jj|d�}|j|jj|�d�dS)	Nrr�r�testrPr=�2z#0)
rTrCrr�rDr�r��get_childrenr�r��columnr�rL)r�item_idZchildrenr�Zbbox_column0Z
root_widthr:r!r!r"r��s$




	zTreeviewTest.test_bboxcCs>|j|jj�f�|jjdd�}|j|jj�t�|j|jj�d|�|jjdd�}|jjdd�}|jj|||�|j|jj|�||f�|jtj	|jj||�|jj|�|j|jj|�f�|jjd�|j|jj�f�dS)Nrr�r)
rrTr]r�r�tupleZset_childrenrOrPr)rr_rrr!r!r"�
test_children�s"zTreeviewTest.test_childrencCsa|j|jjd�t�|jrG|j|jjddd�t�|jjddd�|j|jjdd�|jr�dnd�|j|jjddd�|jr�dnd�|jtj	|jjddd�|jtj	|jjd�dd	id
diddiddid
dig}x-|D]%}|jtj	|jjd|�q4WdS)Nz#0r=r�Z10�id�Xr�Zunknown_optionz
some valueZstretchZwrongr�Zminwidth)
rrTr^rr�rLrrOrPr)rZinvalid_kwsrVr!r!r"�test_column�s	""!
zTreeviewTest.test_columncCs?|jtj|jjd�|jjdd�}|jj|d�}|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jtj|jj	|dd�|jjdd�}|jjdd�}|j|jj�||f�|jj||�|j|jj��dS)Nz#0rr�)
rOrPrrTr�r�rr]r��reattach)rr_�item2�item1r!r!r"�test_delete�szTreeviewTest.test_deletecCs0|jjdd�}|jj|d�}|jj�}|jj�|j||jj��|j|jj�|f�|j|jj|�|f�|jj|�|j|jj��|jj|dd�|j|jj�|f�|j|jj|�|f�|jj|dd�|j|jj�||f�|j|jj|�f�|jt	j
|jjddd�|jt	j
|jjd�|jt	j
|jj|dd�|jt	j
|jj|dd�|jj||�|j|jj�f�|j|jj|�f�dS)Nrr�ZnonexistentZotherparentr�)rTr�r]�detachrr�re�moverOrPr)rr_rf�prevr!r!r"�test_detach_reattach�s4
z!TreeviewTest.test_detach_reattachcCst|j|jjd�d�|j|jjd�d�|j|jji�d�|jtj|jjd�dS)NZ	somethingFrT)rrT�existsrOrPr)rr!r!r"�test_exists"szTreeviewTest.test_existscCs�|j|jj�d�|jjdd�}|jj|�|j|jj�|�|jj|�|j|jj�d�|jtj|jjd�dS)Nrr�rX)rrTr�r�r�rOrPr)rrgr!r!r"�
test_focus-szTreeviewTest.test_focuscCs�|j|jjd�t�|jjddd�|j|jjdd�d�|j|jjddd�d�|jtj|jjddd�|jtj|jjddd�dS)Nz#0r>rXr�r�rH)rrT�headingrrrOrPr)rr!r!r"�test_heading<s"zTreeviewTest.test_headingcs�fdd�}g��jj��jj��jjdd�fdd���jjddd��jj�|d	d	��s��jd
�g��jjj}�jjddt	�jjddd����j
|�jjj�|d	d	��s�jd
�dS)Ncs$t�j||��jj�dS)N)r	rTr�)r�r�)rr!r"�simulate_heading_clickMszBTreeviewTest.test_heading_callback.<locals>.simulate_heading_clickz#0r�cs
�jd�S)NT)r�r!)r�r!r"r�Usz4TreeviewTest.test_heading_callback.<locals>.<lambda>r=r�r'z>The command associated to the treeview heading wasn't invoked.)rTrCrDrpr^r�rBrxZ_tclCommandsr�r)rrrZcommandsr!)rr�r"�test_heading_callbackLs"

"


.
z"TreeviewTest.test_heading_callbackcCs�|jtj|jjd�|j|jjd�d�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|j|jj|�d�|j|jj|�d�|j|jj|�d�|j|jj|�d�|jj|dd�|j|jj|�d�|j|jj|�d�|jj|�|j|jj|�d�|jj|�|j|jj|�d�|jj	|�|jtj|jj|�dS)NZwhatrrr�rH)
rOrPrrTr=rr�rjrir�)rrgrf�c1�c2r!r!r"rHns&zTreeviewTest.test_indexcCs^|jtj|jjdd�|jtj|jjdddd�|jtj|jjdddd�|j|jj|jjdddd���|j|jj|jjdddd���|jtj|jjdd�|jjddd	�}|j|d	�|jtj|jjddd	�|jtj|jjddtd	��d
}|jjddd|f�}|j|jj	|d�|j
r�|fn|�|j|jj	|dd�|j
r�|fn|�|jj	|d|jj|jj	|dd���|j|jj	|dd�|j
r@|fn|�|j
|jj	|�t�|jj	|dd�|j|jj	|dd��|jjdddd
d|g�}|j|jj	|dd�|j
r�dd|fnd|�|jj	|dg�|j|jj	|dd��|jj	|dd�|j|jj	|dd�|j
rodnd�|jjddddd||ff�}|j|jj	|dd�|j
r�dd||ffn
d||f�|j|jj	|jjdddd�dd�d�|j|jj	|jjddd|�dd�|�dS)Nr~r�r�openZpleaseTFZmiddlez
first-itemuábar��tagsrHrFr�r�z1 2 %sz1 2za b cz%s %sz{a b c} {%s %s}r>z
Label here)rHrF)r�r�)rOrPrrTr�r�r�rr�itemr�rBZ	splitlistrr)rZitemidrrxr!r!r"�test_insert_item�s\..
4$!!zTreeviewTest.test_insert_itemcCs�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jtj|jjd�|jjdd�}|jjdd�}|jj|d�}|jj|d�}|jj|d�}|j	|jj
�f�|jj||f�|j	|jj
�||f�|jj|�|j	|jj
�|f�|jj||f�|j	|jj
�|||f�|jj|�|j	|jj
�||||f�|jj||f�|j	|jj
�|||f�|jj|�|j	|jj
�||f�|jj||f�|j	|jj
�||f�|jj|�|j	|jj
�|f�|jjdddd�|jjd�|j	|jj
�d
�|jjdddd�|jjd�|j	|jj
�d�|jjdddd�|jjd�|j	|jj
�d�|jjdddd�|jjd�|j	|jj
�d
�dS)Nr~rr�rb�with spaces�{brace�
unicode€sbytes€�bytes€)rz)r{)r|)r})rOrPrrTZ
selection_setZ
selection_addZselection_removeZselection_toggler�rZ	selection)rrgrfrtruZc3r!r!r"�test_selection�sL"%"zTreeviewTest.test_selectioncCsKddg|jd<|jjdddddg�}|j|jj|�ddddi�|jj|dd�|j|jj|dd�|jr�dnd	�dg|jd<|j|jj|�ddi�|jj|dd�|j|jj|d
d�d�|j|jj|dd�|jr7dnd�|jj|dd�|j|jj|d�|jr{dnd
�|j|jj|dd�|jr�dnd�|j|jj|�|jr�ddin	dd
i�|jtj|jj|d�|jtj|jj|dd�|jtj|jjd�dS)N�A�BrPrr�r�r�r
za ar^zb a�{Z123z123 aZnotme)r�r�)r
r�)r�r�)	rTr�rr�rxr�rOrPr)rrxr!r!r"r.s,!(""""zTreeviewTest.test_setc	s�g�|jjddddg�}|jjddddg�}|jjdd�fdd��|jjdd�fd	d��|jj�|jj�|jj�t�}t�}xktd
dd�D]W}t|�d
kr�P|jj	|�}|r�||kr�|j
|�|j
|�q�W|jt|�d
�x!|D]}t|jd
|�qJW|jt��d�xAt
�ddd
��ddd
��D]}|j|d�q�WdS)Nrr�rwZcallz<ButtonPress-1>cs
�jd�S)NrH)r�)r�)�eventsr!r"r�*sz,TreeviewTest.test_tag_bind.<locals>.<lambda>z<ButtonRelease-1>cs
�jd�S)NrF)r�)r�)r�r!r"r�,srr�r�rF�rH)rHrF)rTr�Ztag_bindrCrDr�r�rAr�Zidentify_rowr�rr	�zip)	rrgrfZpos_y�foundrCr_r�r�r!)r�r"�
test_tag_bind%s2


		

0zTreeviewTest.test_tag_bindcCs�|jt|jj�|jtj|jjddd�|jjddd�|jt|jjdd��d�|jt|jjddd��d�|j|jjd�t	�dS)Nr[ZskyZbluer�)
rO�	TypeErrorrTZ
tag_configurerPrrr�rr)rr!r!r"�test_tag_configureGs
!zTreeviewTest.test_tag_configurecCs�|jjddddddg�}|jjddddddg�}|jt|jj�|jt|jjdd	�|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd|��|j|jjd
|��|j|jjd
|��|j|jjd�|f�|j|jjd�|f�|j|jjd
�f�dS)Nrr�r>zItem 1rwZtag1zItem 2Ztag2znon-existingZtag3)	rTr�rOr�Ztag_hasrr�r�r)rrgrfr!r!r"�test_tag_hasSs$$zTreeviewTest.test_tag_has)rrPrarQrbr$rRr�r3rdr�rS)r9r:r;rfr@rrUrWr�rXr�r�rardrhrlrnrorqrsrHryr~r.r�r�r�r!r!)rEr"rOUs4	*"D3!"rOc@s(eZdZd
ZdZdd�Zd	S)�
SeparatorTestrrar�r3rdr�cKstj|j|�S)N)rZ	SeparatorrB)rrer!r!r"rkszSeparatorTest.createN)rrar�r3rd)r9r:r;rfr4rr!r!r!r"r�csr�c@s"eZdZdZdd�ZdS)	�SizegripTestrrar3rdcKstj|j|�S)N)rZSizegriprB)rrer!r!r"rvszSizegripTest.createN)rrar3rd)r9r:r;rfrr!r!r!r"r�osr��__main__)1ZunittestrPrrZtest.supportrr?Z$tkinter.test.test_ttk.test_functionsrZtkinter.test.supportrrrr	Ztkinter.test.widget_testsr
rrr
rrrrZTestCaser<r]r_rgrwr�r�r�r�r�r�rrrr/ZskipIfr@r7r8rOr�r�Z	tests_guir9�mainr!r!r!r"�<module>sp"4
';0�}�3j"
���