HEX
Server: Apache
System: Linux sg2plmcpnl492417.prod.sin2.secureserver.net 4.18.0-553.58.1.lve.el8.x86_64 #1 SMP Fri Jul 4 12:07:06 UTC 2025 x86_64
User: nyiet8349bzl (9207396)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/tkinter/test/__pycache__/widget_tests.cpython-38.opt-1.pyc
U

�i�_�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�AbstractWidgetTestNFcCs<z|jWStk
r6t|j�dd��|_|jYSXdS)N�tk�scaling)Z_scaling�AttributeError�float�root�call)�self�r�8/opt/python38/lib/python3.8/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_joinr rr(Zcget�	configurer#�len)r�widget�namer!r%r)r'�trrr�
checkParam1s 

zAbstractWidgetTest.checkParamT)�	keep_origc	Cs�||}|dk	r|�|�}|�tj��}|||<W5QRX|dk	rT|�t|j�|�|rj|�|||�n|||<|�tj��}|�||i�W5QRX|dk	r�|�t|j�|�|r�|�|||�n|||<dSr")�formatZassertRaisesr,ZTclErrorr#r �	exceptionr-)rr/r0r!�errmsgr3Zorig�cmrrr�checkInvalidParamEs"
z$AbstractWidgetTest.checkInvalidParamcOs |D]}|j|||f|�qdSr")r2)rr/r0�values�kwargsr!rrr�checkParams[szAbstractWidgetTest.checkParamscOsN|j||f|�|�|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�checkFloatParamhs
�
�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�checkBooleanParamps
�
�z$AbstractWidgetTest.checkBooleanParam)�allow_emptyc
Ks:|j||ddddddddd	d
f|�|j||ddd
�dS)Nz#ff0000z#00ff00z#0000ffz#123456ZredZgreenZblueZwhiteZblackZgreyrBzunknown color name "spam"r=r?)rr/r0rIr:rrr�checkColorParamzs"��
�z"AbstractWidgetTest.checkColorParamcKsD|j||ddddf|�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||f|�|�|dkrld|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�|dkr|j}|D]P}t}|}	t|t�rF|	rF|	tk	rFt|�|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}tdkr(d}|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|�dkr2|�d|f�|D]"}t|t�s6|�d|f�qZq6dS)Nr*zInvalid bounding box: %r)ZassertIsNotNoneZassertIsInstancerr.Zfailr�int)rZbbox�itemrrr�assertIsBoundingBox�s

z&AbstractWidgetTest.assertIsBoundingBoxcCs�|��}|��}|�t|�t|����|D]}||q,tjjr�dddddd�}t|�}t|j	�}t||�D]8}||kr�|||kr�|||kspt
d|jj|f�qpdS)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�s.
�

�
�
�zAbstractWidgetTest.test_keys)N) 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!�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�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�yscrollcommandcCs|��}|�|d�dS)Nr}�rfrJ�rr/rrr�test_activebackground�sz*StandardOptionsTests.test_activebackgroundc
Cs$|��}|�|ddddddd�dS)Nr~r��������?g333333@r���r>�rfrWr�rrr�test_activeborderwidth�s�z+StandardOptionsTests.test_activeborderwidthcCs|��}|�|d�dS)Nrr�r�rrr�test_activeforeground�sz*StandardOptionsTests.test_activeforegroundc
Cs*|��}|�|ddddddddd	d
�dS)Nr��n�ne�eZse�s�sw�wZnw�center�rfrSr�rrr�test_anchors�z StandardOptionsTests.test_anchorcCs.|��}|�|d�d|jkr*|�|d�dS)Nrard�rfrJrmr�rrr�test_backgrounds
z$StandardOptionsTests.test_backgroundcCs~|��}|�|dd�|�|dd�tjjddd�}|�|dd|�d|jj�d	d
�krhd|j��ksz|j	|ddd
d�dS)Nr�Z	questheadZgray50z
python.xbmZ
imghdrdata)Zsubdir�@Zaquar
ZwindowingsystemZAppKitrBzbitmap "spam" not definedr=)
rfr2rirjZfindfilerr
rZwinfo_serverr8)rr/�filenamerrr�test_bitmaps�
�z StandardOptionsTests.test_bitmapc
CsF|��}|�|ddddddd�d|jkrB|�|ddddddd�dS)	Nr`rr��������@rr�r>rc)rfrWrmr�rrr�test_borderwidths�
z%StandardOptionsTests.test_borderwidthc
Cs$|��}|�|ddddddd�dS)Nr�Zbottomr��leftrK�right�topr�r�rrr�
test_compound"s�z"StandardOptionsTests.test_compoundcCs|��}|�|d�dS)Nr�)rfrLr�rrr�test_cursor'sz StandardOptionsTests.test_cursorcCs|��}|�|d�dS)Nr�r�r�rrr�test_disabledforeground+sz,StandardOptionsTests.test_disabledforegroundcCs|��}|�|d�dS)Nr��rfrHr�rrr�test_exportselection/sz)StandardOptionsTests.test_exportselectioncCs,|��}|�|dd�|j|dddd�dS)Nr�z3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*r<zfont "" doesn't existr=)rfr2r8r�rrr�	test_font3s�
�zStandardOptionsTests.test_fontcCs.|��}|�|d�d|jkr*|�|d�dS)Nrbrer�r�rrr�test_foreground:s
z$StandardOptionsTests.test_foregroundcCs|��}|�|d�dS)Nr�r�r�rrr�test_highlightbackground@sz-StandardOptionsTests.test_highlightbackgroundcCs|��}|�|d�dS)Nr�r�r�rrr�test_highlightcolorDsz(StandardOptionsTests.test_highlightcolorc	Cs8|��}|�|dddddd�|j|ddd|jd�dS)	Nr�rr�r�rr>r�rT)rfrWr2rUr�rrr�test_highlightthicknessHs��z,StandardOptionsTests.test_highlightthickness�darwinz"crashes with Cocoa Tk (issue19733)cCs|��}|�|d�dS)NrY�rfrZr�rrr�
test_imageOszStandardOptionsTests.test_imagecCs|��}|�|d�dS)Nr�r�r�rrr�test_insertbackgroundUsz*StandardOptionsTests.test_insertbackgroundc
Cs$|��}|�|ddddddd�dS)Nr�rr�r�rr�r>r�r�rrr�test_insertborderwidthYs�z+StandardOptionsTests.test_insertborderwidthcCs|��}|�|dd�dS)Nr��d�rfr@r�rrr�test_insertofftime^sz'StandardOptionsTests.test_insertofftimecCs|��}|�|dd�dS)Nr�r�r�r�rrr�test_insertontimebsz&StandardOptionsTests.test_insertontimecCs |��}|�|ddddd�dS)Nr�r�r�r�r>r�r�rrr�test_insertwidthfsz%StandardOptionsTests.test_insertwidthcCs|��}|�|d�dS)Nr�r�r�rrr�	test_jumpjszStandardOptionsTests.test_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_justifyns�
�z!StandardOptionsTests.test_justifycCs2|��}|�t|d�|j�|�|ddd�dS)Nr�Z
horizontalZvertical)rfr#r Zdefault_orientrSr�rrr�test_orientwsz StandardOptionsTests.test_orientc
Cs(|��}|j|dddddd|jd�dS)Nr�r皙����@�ffffff@r��12mrA�rfrWrxr�rrr�	test_padx|s�zStandardOptionsTests.test_padxc
Cs(|��}|j|dddddd|jd�dS)Nr�rr�r�r�r�rAr�r�rrr�	test_pady�s�zStandardOptionsTests.test_padycCs|��}|�|d�dS)Nr��rfrXr�rrr�test_relief�sz StandardOptionsTests.test_reliefcCs|��}|�|ddd�dS)Nr�������r�r�rrr�test_repeatdelay�sz%StandardOptionsTests.test_repeatdelaycCs|��}|�|ddd�dS)Nr�r�r�r�r�rrr�test_repeatinterval�sz(StandardOptionsTests.test_repeatintervalcCs|��}|�|d�dS)Nr�r�r�rrr�test_selectbackground�sz*StandardOptionsTests.test_selectbackgroundcCs |��}|�|ddddd�dS)Nr�r�r�r�r>r�r�rrr�test_selectborderwidth�sz+StandardOptionsTests.test_selectborderwidthcCs|��}|�|d�dS)Nr�r�r�rrr�test_selectforeground�sz*StandardOptionsTests.test_selectforegroundcCs|��}|�|d�dS)Nr�r�r�rrr�test_setgrid�sz!StandardOptionsTests.test_setgridcCs|��}|�|dddd�dS)N�stateZactive�disabledZnormalr�r�rrr�
test_state�szStandardOptionsTests.test_statecCs|��}|�|dddd�dS)Nr��0�1r<�rfr;r�rrr�test_takefocus�sz#StandardOptionsTests.test_takefocuscCs|��}|�|ddd�dS)Nr�r<z
any stringr�r�rrr�	test_text�szStandardOptionsTests.test_textcCs&|��}t�|j�}|�|d|�dS)Nr�)rfr,Z	StringVarrr\�rr/r[rrr�test_textvariable�sz&StandardOptionsTests.test_textvariablecCs|��}|�|d�dS)Nr�r�r�rrr�test_troughcolor�sz%StandardOptionsTests.test_troughcolorcCs|��}|�|dddd�dS)Nr�rrF�
r�r�rrr�test_underline�sz#StandardOptionsTests.test_underlinecCs|��}|�|dd�dS)Nr�r�r�r�rrr�test_wraplength�sz$StandardOptionsTests.test_wraplengthcCs|��}|�|d�dS)Nr��rfrOr�rrr�test_xscrollcommand�sz(StandardOptionsTests.test_xscrollcommandcCs|��}|�|d�dS)Nr�r�r�rrr�test_yscrollcommand�sz(StandardOptionsTests.test_yscrollcommandcCs|��}|�|d�dS)NrNr�r�rrr�test_command�sz!StandardOptionsTests.test_commandcCs|��}|�|d�dS)NZindicatoronr�r�rrr�test_indicatoron�sz%StandardOptionsTests.test_indicatoroncCs|��}|�|d�dS)NZ	offreliefr�r�rrr�test_offrelief�sz#StandardOptionsTests.test_offreliefcCs|��}|�|d�dS)NZ
overreliefr�r�rrr�test_overrelief�sz$StandardOptionsTests.test_overreliefcCs|��}|�|d�dS)NZselectcolorr�r�rrr�test_selectcolor�sz%StandardOptionsTests.test_selectcolorcCs|��}|�|d�dS)NZselectimager�r�rrr�test_selectimage�sz%StandardOptionsTests.test_selectimagerr	cCs|��}|�|d�dS)NZ
tristateimager�r�rrr�test_tristateimage�sz'StandardOptionsTests.test_tristateimagecCs|��}|�|dd�dS)NZ
tristatevalueZ
unknowable)rfr2r�rrr�test_tristatevalue�sz'StandardOptionsTests.test_tristatevaluecCs&|��}t�|j�}|�|d|�dS)N�variable)rfr,Z	DoubleVarrr\r�rrr�
test_variable�sz"StandardOptionsTests.test_variableN)=rprtruZSTANDARD_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�rrrrr|�st
�
	

r|c@seZdZdd�Zdd�ZdS)�IntegerSizeTestscCs|��}|�|dddd�dS)N�heightr����rr�r�rrr�test_height�szIntegerSizeTests.test_heightcCs|��}|�|dddd�dS)N�width��n���rr�r�rrr�
test_width�szIntegerSizeTests.test_widthN�rprtrurr
rrrrr�src@seZdZdd�Zdd�ZdS)�PixelSizeTestsc
Cs$|��}|�|ddddddd�dS)Nrr�g�����LY@gfffff�Y@rrZ3cr�r�rrrr�szPixelSizeTests.test_heightc
Cs$|��}|�|ddddddd�dS)Nrrgfffff6y@g�����Iy@r	rZ5ir�r�rrrr
szPixelSizeTests.test_widthNrrrrrr�srcs�fdd�}|S)Ncsn�jD]b}d|}t�|�s�D]$}t||�r t�|t||��qq |f�fdd�	}||_t�||�q�S)NZtest_cs&|��}||td|�jf��dS)NzOption "%s" is not tested in %s)rf�AssertionErrorrp)r�optionr/��clsrrris
�z5add_standard_options.<locals>.decorator.<locals>.test)rm�hasattr�setattr�getattrrp)rrZ
methodnameZsource_classri��source_classesrr�	decorators


�z'add_standard_options.<locals>.decoratorr)rrrrr�add_standard_optionssrcCs&tjjr"t��}td|�dd��dS)Nzpatchlevel =�infoZ
patchlevel)rirjrkr,ZTclrnr)Ztclrrr�setUpModulesr)rrr,Ztkinter.test.supportrrrrrrZtest.supportriZnoconvr rVrwr]rzr+rr|rrrrrrrr�<module>s( 
P