Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/tkinter/test/test_ttk/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/tkinter/test/test_ttk/__pycache__/test_functions.cpython-34.pyo

�
h f�B�@s�ddlZddlZddlmZGdd�d�ZGdd�de�ZGdd�de�ZGd	d
�d
ej�ZGdd�dej�Z	ee	fZ
ed
kr�ddlm
Z
e
e
�ndS)�N)�ttkc@s(eZdZdd�Zdd�ZdS)�	MockTkAppcCs t|t�r|S|jd�S)N�:)�
isinstance�tuple�split)�self�arg�r
�I/opt/alt/python34/lib64/python3.4/tkinter/test/test_ttk/test_functions.py�	splitlistszMockTkApp.splitlistcCsdS)NTr
)rr
r
r�wantobjects
szMockTkApp.wantobjectsN)�__name__�
__module__�__qualname__rr
r
r
r
rrsrc@s.eZdZdZdd�Zdd�ZdS)�
MockTclObj�testcCs
||_dS)N)�val)rrr
r
r�__init__szMockTclObj.__init__cCs
t|j�S)N)�strr)rr
r
r�__str__szMockTclObj.__str__N)rrr�typenamerrr
r
r
rrsrc@s.eZdZdZdd�Zdd�ZdS)�
MockStateSpecZ	StateSpeccGs
||_dS)N)r)r�argsr
r
rrszMockStateSpec.__init__cCsdj|j�S)N� )�joinr)rr
r
rr!szMockStateSpec.__str__N)rrrrrrr
r
r
rrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�InternalFunctionsTestcs�fdd�}�jtji��|tjidd6ddddgd	6�idd
6dd6�|tjidDd6�idd6�|tjiidd6d6�iidd6d6�|tjiddEd
ddgd6dd6d
d6dd6dd6dd6dd6dd �id!d6d"d#6dd$6d%d&6d'd(6d)d*6d+d,6�id d-6d.d/6}|j�}|tj|�id d06d.d16��j||�|tjidFd46�id5d66�|tjidGd46�id8d66�|tjidHd46�id:d66�|tjidId46�id<d66�|tjidJd46�id?d66�|tjidKd46�idAd66�ttj|dBd/��d}�j|t|�d�ttj|dBdL��d}�j|t|�d��jtj|dBt|j����dS)MNcsfxEtdt|�d�D]+}�j|j||�||d�qW|rb�jd|�ndS)Nr��zresult still got elements: %s)�range�len�assertEqual�popZfail)Zfmt_opts�result�i)rr
r�
check_against(s)z@InternalFunctionsTest.test_format_optdict.<locals>.check_againstZblueZfgrr��Zpaddingz-fgz1 2 3 4z-padding�rrz1 2 {} 0z-testzas is�left�2mZtest2Ztest3zabc defZtest4z"abc"Ztest5z{}Ztest6z	} -spam {Ztest7�scriptTz{1 -1 {} 2m 0}�3z-test2z-test3z	{abc def}z-test4z{"abc"}z-test5z\{\}z-test6z
\}\ -spam\ \{z-test7uαβγF�áu-αβγu-á�one two�three�optionz{one two} threez-option�one	twoz{one	two} three�onez{} one�	one} {twozone\}\ \{two three�"one"�twoz{"one"} two�{one}z\{one\} two�ignore�b)rrr(r���)r.r/)r1r/)r(r2)r3r/)r4r5)r6r5)r-r8)�assertFalserZ_format_optdict�copyr!r �list�keys)rr%�optsZ	orig_optsZamount_optsr
)rr�test_format_optdict'sl& $





z)InternalFunctionsTest.test_format_optdictcCsid"d#d$gd6}tj|�}|jt|�tt|j���d	�|j|d%�|jtj|dd
�d&�|jtjigd	6�d'�id(gd6}tj|�}|j|d)�id*gd6}|jtj|�d+�id,gd6}|jttj|�idgddfgd6}|jttj|�iddggd6}|jtj|�d-�xOddddt�fD]5}i|dfgd6}|jtj|�d.�q�Widd6}|jttj|�|jt	tjid/gd6�dS)0Nr8�cr�d�othervalr(�single�ar�-a�{b c} val d otherval {} singler+T� {{b c} val d otherval {} single}�-2r-�vãlu
üñíćódè�-üñíćódè�á vãl�hi�opt�-opt�{ } hir�	valid val�2�value�1 valuerF�{} value�invalid)r8r@zval)rArB)r(rC)rErF)rErG)rHr()r-rI)rJrK)r(r(zhi)rNrO)rrrP)rNrS)rNrT)zinvalid)
rZ_format_mapdictr!r r<r=�assertRaises�	TypeError�set�
IndexError)rr>r#ZvalidrUZstatevalr
r
r�test_format_mapdicts4, 
z)InternalFunctionsTest.test_format_mapdictc
CsQ|jtjd�dff�|jttjd�|jtjddd�dff�|jtjdddd�dff�|jtjdddd �d
ff�|jtjdddd!dd�d#�|jtjdddd$dddg�d%�|jttjd�|jtjdddd�dff�|jtjddddd&�dff�|jtjddddd'dd�d)�|jtjddddddddgfdd�d*�|jttjd�|jtjddd�dff�|jtjdddd�d,�|jtjdddd�d-�dS).N�imageFrztest r(rDz	test {} ar8r@ztest {a b} c�x�test a b�-aTrArr&�{test {a b c} d}�-x {2 3}Zvsapiza b za b {a b} crM�a b a b�-optr�{a b {a b} {1 2}}�-opt x�from�{a})r(rD)rDr8r@)rDr8�r^r\)r]rg)rDr8r@rA)r_r`)rDr8r@)rDr8�rbr\)rarh)rcrd�r8)rDri)rfr8)�
assertTruerZ_format_elemcreaterVrYr!�
ValueError)rr
r
r�test_format_elemcreate�s8

"
z,InternalFunctionsTest.test_format_elemcreatecCsydddd�}dddd�}|jtjg�dd�|jttjdg�tjdgd
d�}|j|tjdgd
d��|j|dd�|j|�|��xRtd�D]D}|j||�||��|j|||�|||��q�W|jttjdd
g�|jttjdg�|jttjdiidd6d6fg�dS)NrrcSsttjdidddgd6dididid	d
6fgd6dd6fgd6fgd6fgd
|d|�dS)NrDrrr&�otherr8r@rArM�nice�children�	something�indent�indent_sizer)rr)r�_format_layoutlist)rqrrr
r
r�sample�s;z<InternalFunctionsTest.test_format_layoutlist.<locals>.samplecsbd�fdd�}d|�||�|d|�|d|�|d|�||�|�fS)Nrcsd|�S)Nrr
)Zamount)rqr
r�<lambda>�szWInternalFunctionsTest.test_format_layoutlist.<locals>.sample_expected.<locals>.<lambda>zi%sa -other {1 2 3} -children {
%sb -children {
%sc -something {1 2} -children {
%sd -nice opt
%s}
%s}
%s}rr&r
)rqrrZspacesr
)rqr�sample_expected�s
zEInternalFunctionsTest.test_format_layoutlist.<locals>.sample_expectedr(rDr8rqr'�bad�format�namero)rDr8)rDN)rDr()znamerw)r!rrsrV�AttributeErrorrrk)rrtrvZsmallestr$r
r
r�test_format_layoutlist�s&
		&

z,InternalFunctionsTest.test_format_layoutlistcCs�|jtjiidd6dd6dd6d6��|jtjiidd6d6�d�idd6d	d
6}|jtjii|d6d6��idgd6}|jtjii|d6d6��|jttjiid
gd6d6�|jtjiid
dgd6d6��iid
ddgd6d6}|jtj|�d�|ddjidd6�|jtj|�d�td�td�g|dddd<|jtj|�d�dS)NZ	configure�mapzelement createryZlayoutzttk::style layout name {
null
}TuαβγFr-�vãlu
üñíćódèr[�state1�state2r�thingzAttk::style element create thing image {name {state1 state2} val} �rMzHttk::style element create thing image {name {state1 state2} val} -opt 30r&r*rzLttk::style element create thing image {name {state1 state2} val} -opt {3 2m})r-r})r~rzvalr9)	r:rZ_script_from_settingsr!rjrVrY�appendr)rZ
configdictZmapdictr[r
r
r�test_script_from_settingss4#		z/InternalFunctionsTest.test_script_from_settingscCsf|jtjtdd�df�dg�|jtjtd�dtd�g�dddg�dS)	NrDr8r�1rZ3mr)rDr8zval)r!rZ
_tclobj_to_pyrr)rr
r
r�test_tclobj_to_pyGs
!z'InternalFunctionsTest.test_tclobj_to_pycs��fdd�}tdd�td�D��}t|�}||dd|�||td�d|�tdd�td�D��}t|�}||dd|�|dtd�dd
�dS)Ncs-�jtj||f�||fg�dS)N)r!rZ_list_from_statespec)ZsspecrRZ	res_valueZstates)rr
r�test_itQsz?InternalFunctionsTest.test_list_from_statespec.<locals>.test_itcss|]}d|VqdS)zstate%dNr
)�.0r$r
r
r�	<genexpr>UszAInternalFunctionsTest.test_list_from_statespec.<locals>.<genexpr>�rcss|]}d|VqdS)zstate%dNr
)r�r$r
r
rr�Zs�rDr8r@)rDr8r@)rDr8r@)rrrr)rr�Zstates_evenZ	statespecZ
states_oddr
)rr�test_list_from_statespecPsz.InternalFunctionsTest.test_list_from_statespecc	CsVt�}|jtj|f��|jtj|d�difg�d}|jtj||�didd6fg�|jtj|ddff�digd6fg�d}|jtj||�didd6d	idd
6d
ifgd6fgd6fg�|jttj|d�|jttj|d�|jttj|d�dS)Nry�-optionrRr0rp�	-childrenro�niceone�otherone�child�	-otheropt�
othervalueZotheropt�no_minus)�name)r�r��value�r��r�r�r�r�r�)r�r�r�r�r�)r�r�)r�r�r�)z	somethingr�)rr:rZ_list_from_layouttupler!rVrk)r�tkZ
sample_ltupleZltupler
r
r�test_list_from_layouttupleas.	

$z0InternalFunctionsTest.test_list_from_layouttuplecCs�dddd�}t�}||_|jtj|id�idd6�|jtj|id
�idd6�|jtj|idd6d�d	�|jtj|idd6d�idd6�dS)NcSs*|dkr|S|dkr dS||fS)Nztest valr
)�resrMrr
r
r�func�s
z4InternalFunctionsTest.test_val_or_dict.<locals>.funcz-test:3r,r�-testr&zx:yztest val)r�r&)r�callr!rZ_val_or_dict)rr�r�r
r
r�test_val_or_dict�s		z&InternalFunctionsTest.test_val_or_dictcCsRdd	d
dgdfdf}x-|D]%\}}|jtj|�|�q%WdS)
Nr�09�	rD�áÚz[]�None)rr)r�r�)rDrD)r�r�)NzNone)r!rZ_convert_stringval)rZtestsZorigZexpectedr
r
r�test_convert_stringval�s	z,InternalFunctionsTest.test_convert_stringvalN)
rrrr?rZrlr{r�r�r�r�r�r�r
r
r
rr%sX);9+	.rc@s4eZdZdd�Zdd�Zdd�ZdS)�TclObjsToPyTestcCseidd6}|jtj|�idd6�t|d�|d<|jtj|�idd6�dS)NuvälúèrM)r!r�
tclobjs_to_pyr)r�adictr
r
r�test_unicode�s
 zTclObjsToPyTest.test_unicodecCs�iddddgd6}|jtj|�iddddgd6�dddg|d<|jtj|�idddgd6�tdd�d	f|d<|jtj|�idgd6�|jtjid
gd6�id
gd6�dS)
Nrrr&r'rMZxmrDr8�válũèzy zr\)rDr8r�)r!rr�r)rr�r
r
r�test_multivalues�s,)z TclObjsToPyTest.test_multivaluescCs+|jtjidd6�idd6�dS)Nz	some text�text)r!rr�)rr
r
r�test_nosplit�szTclObjsToPyTest.test_nosplitN)rrrr�r�r�r
r
r
rr��sr��__main__)�run_unittest)ZunittestZtkinterrr�objectrrZTestCaserr�Ztests_noguirZtest.supportr�r
r
r
r�<module>s

��