Your IP : 216.73.217.32


Current Path : /opt/alt/python39/lib64/python3.9/tkinter/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/tkinter/test/__pycache__/widget_tests.cpython-39.opt-1.pyc

a

XC?h�O�@s�ddlZddlZddlmZmZmZmZmZmZddl	Z
dZe�dkrJeZe
Ze�dd�dkrdeZe�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|jWSty4t|j�dd��|_|jYS0dS)N�tk�scaling)Z_scaling�AttributeError�float�root�call)�self�r�>/opt/alt/python39/lib64/python3.9/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)rZactual�expected�msg�eqrrr�assertEqual2+s
zAbstractWidgetTest.assertEqual2)r$�convr&cCs�|||<|tur|}|r ||�}|js,|jsJt|t�rBt�|�}nt|�}|durVt}|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�n1sD0Y|durh|�t|j�|�|r~|�|||�n|||<|�tj��}|�||i�Wd�n1s�0Y|dur�|�t|j�|�|r�|�|||�n|||<dSr")�formatZassertRaisesr+ZTclErrorr#r Z	exceptionr,)rr.r/r!�errmsgr2Zorig�cmrrr�checkInvalidParamDs"
&,z$AbstractWidgetTest.checkInvalidParamcOs$|D]}|j|||fi|��qdSr")r1)rr.r/�values�kwargsr!rrr�checkParamsZszAbstractWidgetTest.checkParamscOsT|j||g|�Ri|��|j||ddd�|j||ddd�|j||ddd�dS)N�zexpected integer but got ""�r4�10pzexpected integer but got "10p"g������	@zexpected integer but got "3.2"�r9r6)rr.r/r7r8rrr�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"�r1r6)rr.r/r(r7r8r!rrr�checkFloatParamgs
�
�z"AbstractWidgetTest.checkFloatParamcCs`dD]}|j|||dd�qdD]}|j|||dd�q |j||ddd�|j||d	d
d�dS)N)FrZfalseZnoZoffr)r$)T��trueZyesZonrCr:z!expected boolean value but got ""r;r@z%expected boolean value but got "spam"rA)rr.r/r!rrr�checkBooleanParamos
�
�z$AbstractWidgetTest.checkBooleanParam)�allow_emptyc
Ks>|j||ddddddddd	d
fi|��|j||ddd
�dS)Nz#ff0000z#00ff00z#0000ffz#123456ZredZgreenZblueZwhiteZblackZgreyr@zunknown color name "spam"r;r=)rr.r/rFr8rrr�checkColorParamys��
�z"AbstractWidgetTest.checkColorParamcKsH|j||ddddfi|��tdkr2|�||d�|j||ddd	�dS)
NZarrowZwatchZcrossr:)rr	�noner@zbad cursor spec "spam"r;)r9rr1r6)rr.r/r8rrr�checkCursorParam�s
�z#AbstractWidgetTest.checkCursorParamcCs0dd�}|||<|�||�|�||d�dS)NcWsdSr"r)�argsrrr�command�sz5AbstractWidgetTest.checkCommandParam.<locals>.commandr:)Z
assertTruer9)rr.r/rKrrr�checkCommandParam�sz$AbstractWidgetTest.checkCommandParamr;cOs�|j||g|�Ri|��|durrd|d�|dd��t|�dkrFdnd|df}|j||dd|d�d	|}|j||d
|d�dS)Nz %s "{}": must be %s%s or %sz, �����,r:Z	ambiguousr;Zbadr@)r9rr-r6)rr.r/r4r7r8Zerrmsg2rrr�checkEnumParam�s�
�z!AbstractWidgetTest.checkEnumParam)r(r2c
Os�|dur|j}|D]P}t}|}	t|t�rF|	rF|	turFt|�|j}t}	|j|||f||	d�|��q|j||dd|d�|j||dd|d�dS)N�r$r(Z6xzbad screen distance "6x")r4r2r@zbad screen distance "spam")	�_conv_pixelsr*rr rr�roundr1r6)
rr.r/r(r2r7r8r!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 sunkenrr@r;)r9rr6)rr.r/r4rrr�checkReliefParam�s�
�z#AbstractWidgetTest.checkReliefParamcCs@tj|jdd�}|j|||td�|j||ddd�d||<dS)NZimage1)Zmasterr/r?r@zimage "spam" doesn't existr;r:)r+Z
PhotoImagerr1r r6)rr.r/�imagerrr�checkImageParam�s
�z"AbstractWidgetTest.checkImageParamcCs|j|||td�dS)Nr?)r1r )rr.r/�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}||vr�|||vr�|||vspt
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.rd�k�aliasesr$rrr�	test_keys�s.
�

�
�
�zAbstractWidgetTest.test_keys)N) rm�
__module__�__qualname__�staticmethod�pixels_roundrR�_conv_pad_pixelsr�propertyrr�object�__eq__r'r*r1r6r9r>rrBrErGrIrLrPrTrUrWrYr\rprrrrrs8
��	
�
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�anchorr^�bitmapr]�compound�cursor�disabledforeground�exportselection�fontr_�highlightbackground�highlightcolor�highlightthicknessrV�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)Nrz�rcrG�rr.rrr�test_configure_activebackground�sz4StandardOptionsTests.test_configure_activebackgroundc
Cs$|��}|�|ddddddd�dS)Nr{r��������?g333333@r���r<�rcrTr�rrr� test_configure_activeborderwidth�s�z5StandardOptionsTests.test_configure_activeborderwidthcCs|��}|�|d�dS)Nr|r�r�rrr�test_configure_activeforeground�sz4StandardOptionsTests.test_configure_activeforegroundc
Cs*|��}|�|ddddddddd	d
�dS)Nr}�n�ne�eZse�s�sw�wZnw�center�rcrPr�rrr�test_configure_anchors�z*StandardOptionsTests.test_configure_anchorcCs.|��}|�|d�d|jvr*|�|d�dS)Nr^ra�rcrGrjr�rrr�test_configure_backgrounds
z.StandardOptionsTests.test_configure_backgroundcCs~|��}|�|dd�|�|dd�tjjddd�}|�|dd|�d|jj�d	d
�vrhd|j��vsz|j	|ddd
d�dS)Nr~Z	questheadZgray50z
python.xbmZ
imghdrdata)Zsubdir�@Zaquar
ZwindowingsystemZAppKitr@zbitmap "spam" not definedr;)
rcr1rfrgZfindfilerr
rZwinfo_serverr6)rr.�filenamerrr�test_configure_bitmap
s�
�z*StandardOptionsTests.test_configure_bitmapc
CsF|��}|�|ddddddd�d|jvrB|�|ddddddd�dS)	Nr]rr��������@rr�r<r`)rcrTrjr�rrr�test_configure_borderwidths�
z/StandardOptionsTests.test_configure_borderwidthc
Cs$|��}|�|ddddddd�dS)NrZbottomr��leftrH�right�topr�r�rrr�test_configure_compound!s�z,StandardOptionsTests.test_configure_compoundcCs|��}|�|d�dS)Nr�)rcrIr�rrr�test_configure_cursor&sz*StandardOptionsTests.test_configure_cursorcCs|��}|�|d�dS)Nr�r�r�rrr�!test_configure_disabledforeground*sz6StandardOptionsTests.test_configure_disabledforegroundcCs|��}|�|d�dS)Nr��rcrEr�rrr�test_configure_exportselection.sz3StandardOptionsTests.test_configure_exportselectioncCs,|��}|�|dd�|j|dddd�dS)Nr�z3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*r:zfont "" doesn't existr;)rcr1r6r�rrr�test_configure_font2s�
�z(StandardOptionsTests.test_configure_fontcCs.|��}|�|d�d|jvr*|�|d�dS)Nr_rbr�r�rrr�test_configure_foreground9s
z.StandardOptionsTests.test_configure_foregroundcCs|��}|�|d�dS)Nr�r�r�rrr�"test_configure_highlightbackground?sz7StandardOptionsTests.test_configure_highlightbackgroundcCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_highlightcolorCsz2StandardOptionsTests.test_configure_highlightcolorc	Cs8|��}|�|dddddd�|j|ddd|jd�dS)	Nr�rr�r�rr<r�rQ)rcrTr1rRr�rrr�!test_configure_highlightthicknessGs
��z6StandardOptionsTests.test_configure_highlightthicknesscCs|��}|�|d�dS)NrV�rcrWr�rrr�test_configure_imageNsz)StandardOptionsTests.test_configure_imagecCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_insertbackgroundRsz4StandardOptionsTests.test_configure_insertbackgroundc
Cs$|��}|�|ddddddd�dS)Nr�rr�r�rr�r<r�r�rrr� test_configure_insertborderwidthVs�z5StandardOptionsTests.test_configure_insertborderwidthcCs|��}|�|dd�dS)Nr��d�rcr>r�rrr�test_configure_insertofftime[sz1StandardOptionsTests.test_configure_insertofftimecCs|��}|�|dd�dS)Nr�r�r�r�rrr�test_configure_insertontime_sz0StandardOptionsTests.test_configure_insertontimecCs |��}|�|ddddd�dS)Nr�r�r�r�r<r�r�rrr�test_configure_insertwidthcsz/StandardOptionsTests.test_configure_insertwidthcCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_jumpgsz(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)rcrPr6r�rrr�test_configure_justifyks�
�z+StandardOptionsTests.test_configure_justifycCs2|��}|�t|d�|j�|�|ddd�dS)Nr�Z
horizontalZvertical)rcr#r Zdefault_orientrPr�rrr�test_configure_orienttsz*StandardOptionsTests.test_configure_orientc
Cs(|��}|j|dddddd|jd�dS)Nr�r皙����@�ffffff@r��12mr?�rcrTrur�rrr�test_configure_padxys�z(StandardOptionsTests.test_configure_padxc
Cs(|��}|j|dddddd|jd�dS)Nr�rr�r�r�r�r?r�r�rrr�test_configure_pady~s�z(StandardOptionsTests.test_configure_padycCs|��}|�|d�dS)Nr��rcrUr�rrr�test_configure_relief�sz*StandardOptionsTests.test_configure_reliefcCs|��}|�|ddd�dS)Nr�������r�r�rrr�test_configure_repeatdelay�sz/StandardOptionsTests.test_configure_repeatdelaycCs|��}|�|ddd�dS)Nr�r�r�r�r�rrr�test_configure_repeatinterval�sz2StandardOptionsTests.test_configure_repeatintervalcCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_selectbackground�sz4StandardOptionsTests.test_configure_selectbackgroundcCs |��}|�|ddddd�dS)Nr�r�r�r�r<r�r�rrr� test_configure_selectborderwidth�sz5StandardOptionsTests.test_configure_selectborderwidthcCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_selectforeground�sz4StandardOptionsTests.test_configure_selectforegroundcCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_setgrid�sz+StandardOptionsTests.test_configure_setgridcCs|��}|�|dddd�dS)N�stateZactiveZdisabledZnormalr�r�rrr�test_configure_state�sz)StandardOptionsTests.test_configure_statecCs|��}|�|dddd�dS)Nr��0�1r:�rcr9r�rrr�test_configure_takefocus�sz-StandardOptionsTests.test_configure_takefocuscCs|��}|�|ddd�dS)Nr�r:z
any stringr�r�rrr�test_configure_text�sz(StandardOptionsTests.test_configure_textcCs&|��}t�|j�}|�|d|�dS)Nr�)rcr+Z	StringVarrrY�rr.rXrrr�test_configure_textvariable�sz0StandardOptionsTests.test_configure_textvariablecCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_troughcolor�sz/StandardOptionsTests.test_configure_troughcolorcCs|��}|�|dddd�dS)Nr�rrC�
r�r�rrr�test_configure_underline�sz-StandardOptionsTests.test_configure_underlinecCs|��}|�|dd�dS)Nr�r�r�r�rrr�test_configure_wraplength�sz.StandardOptionsTests.test_configure_wraplengthcCs|��}|�|d�dS)Nr��rcrLr�rrr�test_configure_xscrollcommand�sz2StandardOptionsTests.test_configure_xscrollcommandcCs|��}|�|d�dS)Nr�r�r�rrr�test_configure_yscrollcommand�sz2StandardOptionsTests.test_configure_yscrollcommandcCs|��}|�|d�dS)NrKr�r�rrr�test_configure_command�sz+StandardOptionsTests.test_configure_commandcCs|��}|�|d�dS)NZindicatoronr�r�rrr�test_configure_indicatoron�sz/StandardOptionsTests.test_configure_indicatoroncCs|��}|�|d�dS)NZ	offreliefr�r�rrr�test_configure_offrelief�sz-StandardOptionsTests.test_configure_offreliefcCs|��}|�|d�dS)NZ
overreliefr�r�rrr�test_configure_overrelief�sz.StandardOptionsTests.test_configure_overreliefcCs|��}|�|d�dS)NZselectcolorr�r�rrr�test_configure_selectcolor�sz/StandardOptionsTests.test_configure_selectcolorcCs|��}|�|d�dS)NZselectimager�r�rrr�test_configure_selectimage�sz/StandardOptionsTests.test_configure_selectimagerr	cCs|��}|�|d�dS)NZ
tristateimager�r�rrr�test_configure_tristateimage�sz1StandardOptionsTests.test_configure_tristateimagecCs|��}|�|dd�dS)NZ
tristatevalueZ
unknowable)rcr1r�rrr�test_configure_tristatevalue�sz1StandardOptionsTests.test_configure_tristatevaluecCs&|��}t�|j�}|�|d|�dS)NZvariable)rcr+Z	DoubleVarrrYr�rrr�test_configure_variable�sz,StandardOptionsTests.test_configure_variableN)9rmrqrrZSTANDARD_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�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�rrrrry�sn
	

ryc@seZdZdd�Zdd�ZdS)�IntegerSizeTestscCs|��}|�|dddd�dS)N�heightr����rr�r�rrr�test_configure_height�sz&IntegerSizeTests.test_configure_heightcCs|��}|�|dddd�dS)N�width��n���rr�r�rrr�test_configure_width�sz%IntegerSizeTests.test_configure_widthN�rmrqrrr�rrrrrr��sr�c@seZdZdd�Zdd�ZdS)�PixelSizeTestsc
Cs$|��}|�|ddddddd�dS)Nr�r�g�����LY@gfffff�Y@r�rZ3cr�r�rrrr��sz$PixelSizeTests.test_configure_heightc
Cs$|��}|�|ddddddd�dS)Nr�r�gfffff6y@g�����Iy@rrZ5ir�r�rrrr�sz#PixelSizeTests.test_configure_widthNrrrrrr�srcs�fdd�}|S)Ncsn�jD]b}d|}t�|�s�D]$}t||�r t�|t||��qq |f�fdd�	}||_t�||�q�S)NZtest_configure_cs&|��}||td|�jf��dS)NzOption "%s" is not tested in %s)rc�AssertionErrorrm)r�optionr.��clsrrrfs
�z5add_standard_options.<locals>.decorator.<locals>.test)rj�hasattr�setattr�getattrrm)rrZ
methodnameZsource_classrf��source_classesrr�	decorators


�z'add_standard_options.<locals>.decoratorr)rr
rrr�add_standard_optionssrcCs&tjjr"t��}td|�dd��dS)Nzpatchlevel =�infoZ
patchlevel)rfrgrhr+ZTclrkr)Ztclrrr�setUpModulesr)Zunittestr+Ztkinter.test.supportrrrrrrZtest.supportrfZnoconvr rSrtrZrwr*rryr�rrrrrrr�<module>s& 
P