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.7/tkinter/test/__pycache__/widget_tests.cpython-37.pyc
B

��g�M�@s�ddlZddlZddlZddlmZmZmZmZmZm	Z	ddl
ZdZe�dkrRe
ZeZe�dd�dkrleZe�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�AbstractWidgetTestNFcCs6y|jStk
r0t|j�dd��|_|jSXdS)N�tk�scaling)Z_scaling�AttributeError�float�root�call)�self�r�5/usr/local/lib/python3.7/tkinter/test/widget_tests.pyrs
zAbstractWidgetTest.scalingcCs<|js|jrtdkr|St|t�r4d�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�|||<|tkr|}|r ||�}|js,|jsJt|t�rBt�|�}nt|�}|dkrVt}|j	||||d�|j	|�
|�||d�|�|�}|�t
|�d�|j	|d||d�dS)N)r%r	�)�	_sentinelrrrr�tkinterZ_joinrrr&Zcget�	configurer!�len)r�widget�namer r#r'r%�trrr�
checkParam1s 

zAbstractWidgetTest.checkParamT)�	keep_origc	Cs�||}|dk	r|�|�}|�tj��}|||<WdQRX|dk	rT|�t|j�|�|rj|�|||�n|||<|�tj��}|�||i�WdQRX|dk	r�|�t|j�|�|r�|�|||�n|||<dS)N)�formatZassertRaisesr*ZTclErrorr!rZ	exceptionr+)rr-r.r �errmsgr1Zorig�cmrrr�checkInvalidParamEs"
z$AbstractWidgetTest.checkInvalidParamcOs$x|D]}|j|||f|�qWdS)N)r0)rr-r.�values�kwargsr rrr�checkParams[s
zAbstractWidgetTest.checkParamscOsN|j||f|�|�|j||ddd�|j||ddd�|j||ddd�dS)N�zexpected integer but got "")r3�10pzexpected integer but got "10p"g������	@zexpected integer but got "3.2")r8r5)rr-r.r6r7rrr�checkIntegerParam_s


z$AbstractWidgetTest.checkIntegerParam)r'cOsPx&|D]}|j|||fd|i|��qW|j||ddd�|j||ddd�dS)Nr'r9z)expected floating-point number but got "")r3�spamz-expected floating-point number but got "spam")r0r5)rr-r.r'r6r7r rrr�checkFloatParamhs


z"AbstractWidgetTest.checkFloatParamcCshxdD]}|j|||dd�qWxdD]}|j|||dd�q&W|j||ddd�|j||d	d
d�dS)N)FrZfalse�noZoffr)r#)T��trueZyesZonr?r9z!expected boolean value but got "")r3r<z%expected boolean value but got "spam")r0r5)rr-r.r rrr�checkBooleanParamps



z$AbstractWidgetTest.checkBooleanParam)�allow_emptyc
Ks:|j||ddddddddd	d
f|�|j||ddd
�dS)Nz#ff0000z#00ff00z#0000ffz#123456ZredZgreenZblueZwhiteZblackZgreyr<zunknown color name "spam")r3)r8r5)rr-r.rBr7rrr�checkColorParamzs
z"AbstractWidgetTest.checkColorParamcKsD|j||ddddf|�tdkr.|�||d�|j||ddd	�dS)
NZarrowZwatchZcrossr9)rr	�noner<zbad cursor spec "spam")r3)r8rr0r5)rr-r.r7rrr�checkCursorParam�s

z#AbstractWidgetTest.checkCursorParamcCs0dd�}|||<|�||�|�||d�dS)NcWsdS)Nr)�argsrrr�command�sz5AbstractWidgetTest.checkCommandParam.<locals>.commandr9)Z
assertTruer8)rr-r.rGrrr�checkCommandParam�sz$AbstractWidgetTest.checkCommandParam)r3cOs�|j||f|�|�|dkrld|d�|dd��t|�dkr@dnd|df}|j||dd|d�d	|}|j||d
|d�dS)Nz %s "{}": must be %s%s or %sz, �����,r9Z	ambiguous)r3Zbadr<)r8rr,r5)rr-r.r3r6r7Zerrmsg2rrr�checkEnumParam�s
z!AbstractWidgetTest.checkEnumParam)r'r1c
Os�|dkr|j}xX|D]P}t}|}	t|t�rH|	rH|	tk	rHt|�|j}t}	|j|||f||	d�|��qW|j||dd|d�|j||dd|d�dS)N)r#r'Z6xzbad screen distance "6x")r3r1r<zbad screen distance "spam")	�_conv_pixelsr)rrrr�roundr0r5)
rr-r.r'r1r6r7r r#Zconv1rrr�checkPixelsParam�s




z#AbstractWidgetTest.checkPixelsParamc
Cs>|�||dddddd�d}tdkr(d}|j||d	|d
�dS)NZflatZgrooveZraisedZridgeZsolidZsunkenzHbad relief "spam": must be flat, groove, raised, ridge, solid, or sunken)rrr<)r3)r8rr5)rr-r.r3rrr�checkReliefParam�s
z#AbstractWidgetTest.checkReliefParamcCs@tj|jdd�}|j|||td�|j||ddd�d||<dS)NZimage1)Zmasterr.)r'r<zimage "spam" doesn't exist)r3r9)r*Z
PhotoImagerr0rr5)rr-r.�imagerrr�checkImageParam�s

z"AbstractWidgetTest.checkImageParamcCs|j|||td�dS)N)r')r0r)rr-r.�varrrr�checkVariableParam�sz%AbstractWidgetTest.checkVariableParamcCs`|�|�|�|t�t|�dkr2|�d|f�x(|D] }t|t�s8|�d|f�Pq8WdS)Nr(zInvalid bounding box: %r)ZassertIsNotNoneZassertIsInstancerr,Zfailr�int)rZbbox�itemrrr�assertIsBoundingBox�s


z&AbstractWidgetTest.assertIsBoundingBoxcCs�|��}|��}|�t|�t|����x|D]}||q.Wtjjr�dddddd�}t|�}t|j	�}xHt||�D]8}||kr�|||kr�|||ksvt
d|jj|f�qvWdS)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-r_�k�aliasesr#rrr�	test_keys�s&

zAbstractWidgetTest.test_keys)N) rh�
__module__�__qualname__�staticmethod�pixels_roundrM�_conv_pad_pixelsr�propertyrr�object�__eq__r&r)r0r5r8r;rr=rArCrErHrLrOrPrRrTrWrkrrrrrs0	

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!�Ze�ejd"kd#�d$d%��Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d: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�Z0dVdW�Z1dXdY�Z2dZd[�Z3d\d]�Z4d^d_�Z5d`da�Z6dbdc�Z7ddde�Z8e9dfdg�dhdi��Z:e9dfdg�djdk��Z;dldm�Z<dnS)o�StandardOptionsTests)*�activebackground�activeborderwidth�activeforeground�anchorrY�bitmaprX�compound�cursor�disabledforeground�exportselection�fontrZ�highlightbackground�highlightcolor�highlightthicknessrQ�insertbackground�insertborderwidth�
insertofftime�insertontime�insertwidth�jump�justify�orient�padx�pady�relief�repeatdelay�repeatinterval�selectbackground�selectborderwidth�selectforeground�setgrid�	takefocus�text�textvariable�troughcolor�	underline�
wraplength�xscrollcommand�yscrollcommandcCs|��}|�|d�dS)Nru)r^rC)rr-rrr�test_activebackground�sz*StandardOptionsTests.test_activebackgroundc
Cs$|��}|�|ddddddd�dS)Nrvrg�������?g333333@r���r:)r^rO)rr-rrr�test_activeborderwidth�sz+StandardOptionsTests.test_activeborderwidthcCs|��}|�|d�dS)Nrw)r^rC)rr-rrr�test_activeforeground�sz*StandardOptionsTests.test_activeforegroundc
Cs*|��}|�|ddddddddd	d
�dS)Nrx�n�ne�eZse�s�sw�wZnw�center)r^rL)rr-rrr�test_anchorsz StandardOptionsTests.test_anchorcCs.|��}|�|d�d|jkr*|�|d�dS)NrYr\)r^rCre)rr-rrr�test_backgrounds
z$StandardOptionsTests.test_backgroundcCs~|��}|�|dd�|�|dd�tjjddd�}|�|dd|�d|jj�d	d
�krhd|j��ksz|j	|ddd
d�dS)NryZ	questheadZgray50z
python.xbmZ
imghdrdata)Zsubdir�@Zaquar
ZwindowingsystemZAppKitr<zbitmap "spam" not defined)r3)
r^r0rarbZfindfilerr
rZwinfo_serverr5)rr-�filenamerrr�test_bitmaps
z StandardOptionsTests.test_bitmapc
CsF|��}|�|ddddddd�d|jkrB|�|ddddddd�dS)	NrXrg�������?g������@rr�r:r[)r^rOre)rr-rrr�test_borderwidths

z%StandardOptionsTests.test_borderwidthc
Cs$|��}|�|ddddddd�dS)NrzZbottomr��leftrD�right�top)r^rL)rr-rrr�
test_compound"sz"StandardOptionsTests.test_compoundcCs|��}|�|d�dS)Nr{)r^rE)rr-rrr�test_cursor'sz StandardOptionsTests.test_cursorcCs|��}|�|d�dS)Nr|)r^rC)rr-rrr�test_disabledforeground+sz,StandardOptionsTests.test_disabledforegroundcCs|��}|�|d�dS)Nr})r^rA)rr-rrr�test_exportselection/sz)StandardOptionsTests.test_exportselectioncCs,|��}|�|dd�|j|dddd�dS)Nr~z3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*r9zfont "" doesn't exist)r3)r^r0r5)rr-rrr�	test_font3s

zStandardOptionsTests.test_fontcCs.|��}|�|d�d|jkr*|�|d�dS)NrZr])r^rCre)rr-rrr�test_foreground:s
z$StandardOptionsTests.test_foregroundcCs|��}|�|d�dS)Nr)r^rC)rr-rrr�test_highlightbackground@sz-StandardOptionsTests.test_highlightbackgroundcCs|��}|�|d�dS)Nr�)r^rC)rr-rrr�test_highlightcolorDsz(StandardOptionsTests.test_highlightcolorc	Cs8|��}|�|dddddd�|j|ddd|jd�dS)	Nr�rg�������?g������@rr:r�)r#r')r^rOr0rM)rr-rrr�test_highlightthicknessHs
z,StandardOptionsTests.test_highlightthickness�darwinz"crashes with Cocoa Tk (issue19733)cCs|��}|�|d�dS)NrQ)r^rR)rr-rrr�
test_imageOszStandardOptionsTests.test_imagecCs|��}|�|d�dS)Nr�)r^rC)rr-rrr�test_insertbackgroundUsz*StandardOptionsTests.test_insertbackgroundc
Cs$|��}|�|ddddddd�dS)Nr�rg�������?g������@rr�r:)r^rO)rr-rrr�test_insertborderwidthYsz+StandardOptionsTests.test_insertborderwidthcCs|��}|�|dd�dS)Nr��d)r^r;)rr-rrr�test_insertofftime^sz'StandardOptionsTests.test_insertofftimecCs|��}|�|dd�dS)Nr�r�)r^r;)rr-rrr�test_insertontimebsz&StandardOptionsTests.test_insertontimecCs |��}|�|ddddd�dS)Nr�g�������?g������@r�r:)r^rO)rr-rrr�test_insertwidthfsz%StandardOptionsTests.test_insertwidthcCs|��}|�|d�dS)Nr�)r^rA)rr-rrr�	test_jumpjszStandardOptionsTests.test_jumpcCs4|��}|j|dddddd�|j|dddd�dS)	Nr�r�r�r�z6bad justification "{}": must be left, right, or center)r3r9z:ambiguous justification "": must be left, right, or center)r^rLr5)rr-rrr�test_justifyns

z!StandardOptionsTests.test_justifycCs2|��}|�t|d�|j�|�|ddd�dS)Nr�Z
horizontalZvertical)r^r!rZdefault_orientrL)rr-rrr�test_orientwsz StandardOptionsTests.test_orientc
Cs(|��}|j|dddddd|jd�dS)Nr�rg������@gffffff@r��12m)r')r^rOrp)rr-rrr�	test_padx|szStandardOptionsTests.test_padxc
Cs(|��}|j|dddddd|jd�dS)Nr�rg������@gffffff@r�r�)r')r^rOrp)rr-rrr�	test_pady�szStandardOptionsTests.test_padycCs|��}|�|d�dS)Nr�)r^rP)rr-rrr�test_relief�sz StandardOptionsTests.test_reliefcCs|��}|�|ddd�dS)Nr�i���i�)r^r;)rr-rrr�test_repeatdelay�sz%StandardOptionsTests.test_repeatdelaycCs|��}|�|ddd�dS)Nr�i���i�)r^r;)rr-rrr�test_repeatinterval�sz(StandardOptionsTests.test_repeatintervalcCs|��}|�|d�dS)Nr�)r^rC)rr-rrr�test_selectbackground�sz*StandardOptionsTests.test_selectbackgroundcCs |��}|�|ddddd�dS)Nr�g�������?g������@r�r:)r^rO)rr-rrr�test_selectborderwidth�sz+StandardOptionsTests.test_selectborderwidthcCs|��}|�|d�dS)Nr�)r^rC)rr-rrr�test_selectforeground�sz*StandardOptionsTests.test_selectforegroundcCs|��}|�|d�dS)Nr�)r^rA)rr-rrr�test_setgrid�sz!StandardOptionsTests.test_setgridcCs|��}|�|dddd�dS)N�stateZactiveZdisabledZnormal)r^rL)rr-rrr�
test_state�szStandardOptionsTests.test_statecCs|��}|�|dddd�dS)Nr��0�1r9)r^r8)rr-rrr�test_takefocus�sz#StandardOptionsTests.test_takefocuscCs|��}|�|ddd�dS)Nr�r9z
any string)r^r8)rr-rrr�	test_text�szStandardOptionsTests.test_textcCs&|��}t�|j�}|�|d|�dS)Nr�)r^r*Z	StringVarrrT)rr-rSrrr�test_textvariable�sz&StandardOptionsTests.test_textvariablecCs|��}|�|d�dS)Nr�)r^rC)rr-rrr�test_troughcolor�sz%StandardOptionsTests.test_troughcolorcCs|��}|�|dddd�dS)Nr�rr?�
)r^r;)rr-rrr�test_underline�sz#StandardOptionsTests.test_underlinecCs|��}|�|dd�dS)Nr�r�)r^rO)rr-rrr�test_wraplength�sz$StandardOptionsTests.test_wraplengthcCs|��}|�|d�dS)Nr�)r^rH)rr-rrr�test_xscrollcommand�sz(StandardOptionsTests.test_xscrollcommandcCs|��}|�|d�dS)Nr�)r^rH)rr-rrr�test_yscrollcommand�sz(StandardOptionsTests.test_yscrollcommandcCs|��}|�|d�dS)NrG)r^rH)rr-rrr�test_command�sz!StandardOptionsTests.test_commandcCs|��}|�|d�dS)NZindicatoron)r^rA)rr-rrr�test_indicatoron�sz%StandardOptionsTests.test_indicatoroncCs|��}|�|d�dS)NZ	offrelief)r^rP)rr-rrr�test_offrelief�sz#StandardOptionsTests.test_offreliefcCs|��}|�|d�dS)NZ
overrelief)r^rP)rr-rrr�test_overrelief�sz$StandardOptionsTests.test_overreliefcCs|��}|�|d�dS)NZselectcolor)r^rC)rr-rrr�test_selectcolor�sz%StandardOptionsTests.test_selectcolorcCs|��}|�|d�dS)NZselectimage)r^rR)rr-rrr�test_selectimage�sz%StandardOptionsTests.test_selectimagerr	cCs|��}|�|d�dS)NZ
tristateimage)r^rR)rr-rrr�test_tristateimage�sz'StandardOptionsTests.test_tristateimagecCs|��}|�|dd�dS)NZ
tristatevalueZ
unknowable)r^r0)rr-rrr�test_tristatevalue�sz'StandardOptionsTests.test_tristatevaluecCs&|��}t�|j�}|�|d|�dS)N�variable)r^r*Z	DoubleVarrrT)rr-rSrrr�
test_variable�sz"StandardOptionsTests.test_variableN)=rhrlrmZSTANDARD_OPTIONSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��unittestZskipIf�sys�platformr�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�rr�r�r�rrrrrt�sl

	rtc@seZdZdd�Zdd�ZdS)�IntegerSizeTestscCs|��}|�|dddd�dS)N�heightr�i����r)r^r;)rr-rrr�test_height�szIntegerSizeTests.test_heightcCs|��}|�|dddd�dS)N�widthi�in���r)r^r;)rr-rrr�
test_width�szIntegerSizeTests.test_widthN)rhrlrmr�r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)�PixelSizeTestsc
Cs$|��}|�|ddddddd�dS)Nr�r�g�����LY@gfffff�Y@i����rZ3c)r^rO)rr-rrrr��szPixelSizeTests.test_heightc
Cs$|��}|�|ddddddd�dS)Nr�i�gfffff6y@g�����Iy@in���rZ5i)r^rO)rr-rrrr�szPixelSizeTests.test_widthN)rhrlrmr�r�rrrrr��sr�cs�fdd�}|S)Ncstxn�jD]d}d|}t�|�sxL�D]"}t||�r$t�|t||��Pq$W|f�fdd�	}||_t�||�qW�S)NZtest_cs&|��}||td|�jf��dS)NzOption "%s" is not tested in %s)r^�AssertionErrorrh)r�optionr-)�clsrrrasz5add_standard_options.<locals>.decorator.<locals>.test)re�hasattr�setattr�getattrrh)r�r�Z
methodnameZsource_classra)�source_classes)r�r�	decorators


z'add_standard_options.<locals>.decoratorr)r�r�r)r�r�add_standard_optionssr�cCs&tjjr"t��}td|�dd��dS)Nzpatchlevel =�infoZ
patchlevel)rarbrcr*ZTclrfr)Ztclrrr�setUpModulesr�)r�r�r*Ztkinter.test.supportrrrrrrZtest.supportraZnoconvrrNrorUrrr)rrtr�r�r�r�rrrr�<module>s( 
P