HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/tkinter/test/__pycache__/widget_tests.cpython-310.opt-2.pyc
o

�i�O�@s�ddlZddlZddlmZmZmZmZmZmZddl	Z
dZe�dkr%eZe
Ze�dd�dkr2eZe�ZGdd�de�ZGdd	�d	�ZGd
d�d�ZGdd
�d
�Zdd�Zdd�ZdS)�N)�AbstractTkTest�tcl_version�requires_tcl�get_tk_patchlevel�pixels_conv�
tcl_obj_eqF)����c@s�eZdZee�ZdZdZedd��Z	dd�Z
dejfdd�Z
eddd	�d
d�Zd0dd
�dd�Zdd�Zdd�Zed�dd�Zdd�Zdd�dd�Zdd�Zdd�Zdd �d!d"�Zddd#�d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1�AbstractWidgetTestNFcCs6z|jWStyt|j�dd��|_|jYSw)N�tk�scaling)Z_scaling�AttributeError�float�root�call)�self�r�6/usr/local/lib/python3.10/tkinter/test/widget_tests.pyrs
�zAbstractWidgetTest.scalingcCs<|js|jrtdkr|St|t�rd�t|j|��St|�S)N�r�� )	�
_stringify�wantobjectsr�
isinstance�tuple�join�map�_str�str)r�valuerrrr$s

zAbstractWidgetTest._strcCs |||�rdS|�|||�dS�N)�assertEqual)r�actual�expected�msg�eqrrr�assertEqual2+s
zAbstractWidgetTest.assertEqual2)r%�convr'cCs�|||<|tur
|}|r||�}|js|js%t|t�r!t�|�}nt|�}|dur+t}|j	||||d�|j	|�
|�||d�|�|�}|�t
|�d�|j	|d||d�dS)N)r'r	�)�	_sentinelrrrr�tkinterZ_joinr rr(Zcget�	configurer#�len)r�widget�namer!r%r)r'�trrr�
checkParam0s 

zAbstractWidgetTest.checkParamT)�	keep_origcCs�||}|dur
|�|�}|�tj��}|||<Wd�n1s"wY|dur4|�t|j�|�|r?|�|||�n|||<|�tj��}|�||i�Wd�n1s[wY|durm|�t|j�|�|ry|�|||�dS|||<dSr")�formatZassertRaisesr,ZTclErrorr#r �	exceptionr-)rr/r0r!�errmsgr3Zorig�cmrrr�checkInvalidParamDs&

��z$AbstractWidgetTest.checkInvalidParamcOs$|D]
}|j|||fi|��qdSr")r2)rr/r0�values�kwargsr!rrr�checkParamsZs�zAbstractWidgetTest.checkParamscOsT|j||g|�Ri|��|j||ddd�|j||ddd�|j||ddd�dS)N�zexpected integer but got ""�r6�10pzexpected integer but got "10p"g������	@zexpected integer but got "3.2"�r;r8)rr/r0r9r:rrr�checkIntegerParam^s
�
�

�z$AbstractWidgetTest.checkIntegerParam�r)cOsL|D]}|j|||fd|i|��q|j||ddd�|j||ddd�dS)Nr)r<z)expected floating-point number but got ""r=�spamz-expected floating-point number but got "spam"�r2r8)rr/r0r)r9r:r!rrr�checkFloatParamgs
�

�z"AbstractWidgetTest.checkFloatParamcCs`dD]}|j|||dd�qdD]}|j|||dd�q|j||ddd�|j||d	d
d�dS)N)FrZfalse�noZoffr)r%)T��trueZyesZonrFr<z!expected boolean value but got ""r=rBz%expected boolean value but got "spam"rC)rr/r0r!rrr�checkBooleanParamos
�

�z$AbstractWidgetTest.checkBooleanParam)�allow_emptyc
Ks>|j||ddddddddd	d
fi|��|j||ddd
�dS)Nz#ff0000z#00ff00z#0000ffz#123456ZredZgreenZblueZwhiteZblackZgreyrBzunknown color name "spam"r=r?)rr/r0rIr:rrr�checkColorParamys��

�z"AbstractWidgetTest.checkColorParamcKsH|j||ddddfi|��tdkr|�||d�|j||ddd	�dS)
NZarrowZwatchZcrossr<)rr	�nonerBzbad cursor spec "spam"r=)r;rr2r8)rr/r0r:rrr�checkCursorParam�s

�z#AbstractWidgetTest.checkCursorParamcCs0dd�}|||<|�||�|�||d�dS)NcWsdSr"r)�argsrrr�command�sz5AbstractWidgetTest.checkCommandParam.<locals>.commandr<)Z
assertTruer;)rr/r0rNrrr�checkCommandParam�sz$AbstractWidgetTest.checkCommandParamr=cOs�|j||g|�Ri|��|dur9d|d�|dd��t|�dkr#dnd|df}|j||dd|d�d	|}|j||d
|d�dS)Nz %s "{}": must be %s%s or %sz, �����,r<Z	ambiguousr=ZbadrB)r;rr.r8)rr/r0r6r9r:Zerrmsg2rrr�checkEnumParam�s�
�z!AbstractWidgetTest.checkEnumParam)r)r3c
Os�|dur|j}|D](}t}|}	t|t�r#|	r#|	tur#t|�|j}t}	|j|||f||	d�|��q	|j||dd|d�|j||dd|d�dS)N�r%r)Z6xzbad screen distance "6x")r6r3rBzbad screen distance "spam")	�_conv_pixelsr+rr rr�roundr2r8)
rr/r0r)r3r9r:r!r%Zconv1rrr�checkPixelsParam�s(
��
�

�z#AbstractWidgetTest.checkPixelsParamc
Cs>|�||dddddd�d}tdkrd}|j||d	|d
�dS)NZflatZgrooveZraisedZridgeZsolidZsunkenzHbad relief "spam": must be flat, groove, raised, ridge, solid, or sunkenrrBr=)r;rr8)rr/r0r6rrr�checkReliefParam�s�

�z#AbstractWidgetTest.checkReliefParamcCs@tj|jdd�}|j|||td�|j||ddd�d||<dS)NZimage1)Zmasterr0rArBzimage "spam" doesn't existr=r<)r,Z
PhotoImagerr2r r8)rr/r0�imagerrr�checkImageParam�s
�z"AbstractWidgetTest.checkImageParamcCs|j|||td�dS)NrA)r2r )rr/r0�varrrr�checkVariableParam�sz%AbstractWidgetTest.checkVariableParamcCs`|�|�|�|t�t|�dkr|�d|f�|D]}t|t�s-|�d|f�dSqdS)Nr*zInvalid bounding box: %r)ZassertIsNotNoneZassertIsInstancerr.Zfailr�int)rZbbox�itemrrr�assertIsBoundingBox�s

��z&AbstractWidgetTest.assertIsBoundingBoxcCs�|��}|��}|�t|�t|����|D]}||qtjjrUdddddd�}t|�}t|j	�}t||�D]}||vrJ|||vrJ|||vsTt
d|jj|f�q8dSdS)N�borderwidth�
background�
foregroundZinvalidcommandZvalidatecommand)�bd�bg�fgZinvcmdZvcmdz%s.OPTIONS doesn't contain "%s")
�create�keysr#�sortedr-�test�support�verbose�set�OPTIONS�print�	__class__�__name__)rr/rg�k�aliasesr%rrr�	test_keys�s0
�

���
zAbstractWidgetTest.test_keysr") rp�
__module__�__qualname__�staticmethod�pixels_roundrU�_conv_pad_pixelsr�propertyrr�object�__eq__r(r+r2r8r;r@rrDrHrJrLrOrSrWrXrZr\r_rsrrrrrs:
��	
�
rc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dRdS�Z,dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4e5ddde�dfdg��Z6e5ddde�dhdi��Z7djdk�Z8dlS)m�StandardOptionsTests)*�activebackground�activeborderwidth�activeforeground�anchorra�bitmapr`�compound�cursor�disabledforeground�exportselection�fontrb�highlightbackground�highlightcolor�highlightthicknessrY�insertbackground�insertborderwidth�
insertofftime�insertontime�insertwidth�jump�justify�orient�padx�pady�relief�repeatdelay�repeatinterval�selectbackground�selectborderwidth�selectforeground�setgrid�	takefocus�text�textvariable�troughcolor�	underline�
wraplength�xscrollcommand�yscrollcommandcC�|��}|�|d�dS)Nr}�rfrJ�rr/rrr�test_configure_activebackground��z4StandardOptionsTests.test_configure_activebackgroundc
C�$|��}|�|ddddddd�dS)Nr~r��������?g333333@r���r>�rfrWr�rrr� test_configure_activeborderwidth���z5StandardOptionsTests.test_configure_activeborderwidthcCr�)Nrr�r�rrr�test_configure_activeforeground�r�z4StandardOptionsTests.test_configure_activeforegroundc
Cs*|��}|�|ddddddddd	d
�dS)Nr��n�ne�eZse�s�sw�wZnw�center�rfrSr�rrr�test_configure_anchors�z*StandardOptionsTests.test_configure_anchorcC�2|��}|�|d�d|jvr|�|d�dSdS)Nrard�rfrJrmr�rrr�test_configure_background�

�z.StandardOptionsTests.test_configure_backgroundcCs�|��}|�|dd�|�|dd�tjjddd�}|�|dd|�d|jj�d	d
�vr4d|j��vs?|j	|ddd
d�dSdS)Nr�Z	questheadZgray50z
python.xbmZ
imghdrdata)Zsubdir�@Zaquar
ZwindowingsystemZAppKitrBzbitmap "spam" not definedr=)
rfr2rirjZfindfilerr
rZwinfo_serverr8)rr/�filenamerrr�test_configure_bitmap
s

��z*StandardOptionsTests.test_configure_bitmapc
CsJ|��}|�|ddddddd�d|jvr#|�|ddddddd�dSdS)	Nr`rr��������@rr�r>rc)rfrWrmr�rrr�test_configure_borderwidths�
�z/StandardOptionsTests.test_configure_borderwidthc
Cr�)Nr�Zbottomr��leftrK�right�topr�r�rrr�test_configure_compound!r�z,StandardOptionsTests.test_configure_compoundcCr�)Nr�)rfrLr�rrr�test_configure_cursor&r�z*StandardOptionsTests.test_configure_cursorcCr�)Nr�r�r�rrr�!test_configure_disabledforeground*r�z6StandardOptionsTests.test_configure_disabledforegroundcCr�)Nr��rfrHr�rrr�test_configure_exportselection.r�z3StandardOptionsTests.test_configure_exportselectioncCs,|��}|�|dd�|j|dddd�dS)Nr�z3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*r<zfont "" doesn't existr=)rfr2r8r�rrr�test_configure_font2s�

�z(StandardOptionsTests.test_configure_fontcCr�)Nrbrer�r�rrr�test_configure_foreground9r�z.StandardOptionsTests.test_configure_foregroundcCr�)Nr�r�r�rrr�"test_configure_highlightbackground?r�z7StandardOptionsTests.test_configure_highlightbackgroundcCr�)Nr�r�r�rrr�test_configure_highlightcolorCr�z2StandardOptionsTests.test_configure_highlightcolorc	Cs8|��}|�|dddddd�|j|ddd|jd�dS)	Nr�rr�r�rr>r�rT)rfrWr2rUr�rrr�!test_configure_highlightthicknessGs
�
�z6StandardOptionsTests.test_configure_highlightthicknesscCr�)NrY�rfrZr�rrr�test_configure_imageNr�z)StandardOptionsTests.test_configure_imagecCr�)Nr�r�r�rrr�test_configure_insertbackgroundRr�z4StandardOptionsTests.test_configure_insertbackgroundc
Cr�)Nr�rr�r�rr�r>r�r�rrr� test_configure_insertborderwidthVr�z5StandardOptionsTests.test_configure_insertborderwidthcC�|��}|�|dd�dS)Nr��d�rfr@r�rrr�test_configure_insertofftime[�z1StandardOptionsTests.test_configure_insertofftimecCr�)Nr�r�r�r�rrr�test_configure_insertontime_r�z0StandardOptionsTests.test_configure_insertontimecC� |��}|�|ddddd�dS)Nr�r�r�r�r>r�r�rrr�test_configure_insertwidthc�z/StandardOptionsTests.test_configure_insertwidthcCr�)Nr�r�r�rrr�test_configure_jumpgr�z(StandardOptionsTests.test_configure_jumpcCs4|��}|j|dddddd�|j|dddd�dS)	Nr�r�r�r�z6bad justification "{}": must be left, right, or centerr=r<z:ambiguous justification "": must be left, right, or center)rfrSr8r�rrr�test_configure_justifyks�

�z+StandardOptionsTests.test_configure_justifycCs2|��}|�t|d�|j�|�|ddd�dS)Nr�Z
horizontalZvertical)rfr#r Zdefault_orientrSr�rrr�test_configure_orienttsz*StandardOptionsTests.test_configure_orientc
C�(|��}|j|dddddd|jd�dS)Nr�r皙����@�ffffff@r��12mrA�rfrWrxr�rrr�test_configure_padxy�
�z(StandardOptionsTests.test_configure_padxc
Cr�)Nr�rr�r�r�r�rAr�r�rrr�test_configure_pady~r�z(StandardOptionsTests.test_configure_padycCr�)Nr��rfrXr�rrr�test_configure_relief�r�z*StandardOptionsTests.test_configure_reliefcC�|��}|�|ddd�dS)Nr�������r�r�rrr�test_configure_repeatdelay��z/StandardOptionsTests.test_configure_repeatdelaycCr�)Nr�r�r�r�r�rrr�test_configure_repeatinterval�r�z2StandardOptionsTests.test_configure_repeatintervalcCr�)Nr�r�r�rrr�test_configure_selectbackground�r�z4StandardOptionsTests.test_configure_selectbackgroundcCr�)Nr�r�r�r�r>r�r�rrr� test_configure_selectborderwidth�r�z5StandardOptionsTests.test_configure_selectborderwidthcCr�)Nr�r�r�rrr�test_configure_selectforeground�r�z4StandardOptionsTests.test_configure_selectforegroundcCr�)Nr�r�r�rrr�test_configure_setgrid�r�z+StandardOptionsTests.test_configure_setgridcC�|��}|�|dddd�dS)N�stateZactive�disabledZnormalr�r�rrr�test_configure_state��z)StandardOptionsTests.test_configure_statecCr�)Nr��0�1r<�rfr;r�rrr�test_configure_takefocus�r�z-StandardOptionsTests.test_configure_takefocuscCr�)Nr�r<z
any stringr�r�rrr�test_configure_text�r�z(StandardOptionsTests.test_configure_textcC�&|��}t�|j�}|�|d|�dS)Nr�)rfr,Z	StringVarrr\�rr/r[rrr�test_configure_textvariable��z0StandardOptionsTests.test_configure_textvariablecCr�)Nr�r�r�rrr�test_configure_troughcolor�r�z/StandardOptionsTests.test_configure_troughcolorcCr�)Nr�rrF�
r�r�rrr�test_configure_underline�r�z-StandardOptionsTests.test_configure_underlinecCr�)Nr�r�r�r�rrr�test_configure_wraplength�r�z.StandardOptionsTests.test_configure_wraplengthcCr�)Nr��rfrOr�rrr�test_configure_xscrollcommand�r�z2StandardOptionsTests.test_configure_xscrollcommandcCr�)Nr�rr�rrr�test_configure_yscrollcommand�r�z2StandardOptionsTests.test_configure_yscrollcommandcCr�)NrNrr�rrr�test_configure_command�r�z+StandardOptionsTests.test_configure_commandcCr�)NZindicatoronr�r�rrr�test_configure_indicatoron�r�z/StandardOptionsTests.test_configure_indicatoroncCr�)NZ	offreliefr�r�rrr�test_configure_offrelief�r�z-StandardOptionsTests.test_configure_offreliefcCr�)NZ
overreliefr�r�rrr�test_configure_overrelief�r�z.StandardOptionsTests.test_configure_overreliefcCr�)NZselectcolorr�r�rrr�test_configure_selectcolor�r�z/StandardOptionsTests.test_configure_selectcolorcCr�)NZselectimager�r�rrr�test_configure_selectimage�r�z/StandardOptionsTests.test_configure_selectimagerr	cCr�)NZ
tristateimager�r�rrr�test_configure_tristateimage�sz1StandardOptionsTests.test_configure_tristateimagecCr�)NZ
tristatevalueZ
unknowable)rfr2r�rrr�test_configure_tristatevalue�sz1StandardOptionsTests.test_configure_tristatevaluecCr�)N�variable)rfr,Z	DoubleVarrr\r�rrr�test_configure_variable�r�z,StandardOptionsTests.test_configure_variableN)9rprtruZSTANDARD_OPTIONSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr	r
rrrr
rrrrrrr|�sp
	

r|c@�eZdZdd�Zdd�ZdS)�IntegerSizeTestscCr�)N�heightr����rr�r�rrr�test_configure_height�r�z&IntegerSizeTests.test_configure_heightcCr�)N�width��n���rr�r�rrr�test_configure_width�r�z%IntegerSizeTests.test_configure_widthN�rprtrurrrrrrr��rc@r)�PixelSizeTestsc
Cr�)Nrr�g�����LY@gfffff�Y@rrZ3cr�r�rrrr��z$PixelSizeTests.test_configure_heightc
Cr�)Nrrgfffff6y@g�����Iy@rrZ5ir�r�rrrr�rz#PixelSizeTests.test_configure_widthNrrrrrr�rrcs�fdd�}|S)Ncsn�jD]1}d|}t�|�s4�D]}t||�r"t�|t||��nq|f�fdd�	}||_t�||�q�S)NZtest_configure_cs"|��}||td|�jf��)NzOption "%s" is not tested in %s)rf�AssertionErrorrp)r�optionr/��clsrrris
�z5add_standard_options.<locals>.decorator.<locals>.test)rm�hasattr�setattr�getattrrp)r!rZ
methodnameZsource_classri��source_classesr r�	decorators


���z'add_standard_options.<locals>.decoratorr)r&r'rr%r�add_standard_optionssr(cCs*tjjrt��}td|�dd��dSdS)Nzpatchlevel =�infoZ
patchlevel)rirjrkr,ZTclrnr)Ztclrrr�setUpModules�r*)Zunittestr,Ztkinter.test.supportrrrrrrZtest.supportriZnoconvr rVrwr]rzr+rr|rrr(r*rrrr�<module>s( 
P