Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�ddlZddlZddlZdefd��YZdefd��YZdejfd��YZdejfd	��YZeefZ	e
d
kr�ddlmZee	�ndS(i�Nt
MockTclObjcBs eZdZd�Zd�ZRS(ttestcCs
||_dS(N(tval(tselfR((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyt__init__	scCs
t|j�S(N(tunicodeR(R((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyt__str__s(t__name__t
__module__ttypenameRR(((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	t
MockStateSpeccBs eZdZd�Zd�ZRS(t	StateSpeccGs
||_dS(N(R(Rtargs((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyRscCsdj|j�S(Nt (tjoinR(R((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyRs(RRR	RR(((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyR
s	tInternalFunctionsTestcBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cs
�fd�}�jtji��|tjidd6ddddgd6�idd	6d
d6�|tjidBd6�idd6�|tjiidd6d6�iidd6d6�|tjiddddd
gd6dd6dd6dd6dd6dd6dd6dt�id d6d!d"6dd#6d$d%6d&d'6d(d)6d*d+6�itd,6td-6}|j�}|tj|�itd.6td/6��j||�|tjidCd26�id3d46�|tjidDd26�id6d46�|tjidEd26�id8d46�|tjidFd26�id:d46�|tjidGd26�id=d46�|tjidHd26�id?d46�ttj|d@d-��d}�j|t|�d�ttj|d@dI��d}�j|t|�d��jtj|d@|j���dS(JNcsfxEtdt|�d�D]+}�j|j||�||d�qW|rb�jd|�ndS(Niiisresult still got elements: %s(trangetlentassertEqualtpoptfail(tfmt_optstresultti(R(s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyt
check_againsts)tbluetfgiiiitpaddings-fgs1 2 3 4s-paddingtiRs1 2 {} 0s-testsas istlefti�t2mttest2ttest3sabc defttest4s"abc"ttest5s{}ttest6s	} -spam {ttest7tscripts{1 -1 {} 2m 0}t3s-test2s-test3s	{abc def}s-test4s{"abc"}s-test5s\{\}s-test6s
\}\ -spam\ \{s-test7uαβγuáu-αβγu-ásone twotthreetoptions{one two} threes-optionsone	twos{one	two} threetones{} ones	one} {twosone\}\ \{two threes"one"ttwos{"one"} twos{one}s\{one\} twotignoretb(iiRi(sone twoR'(sone	twoR'(RR)(s	one} {twoR'(s"one"R*(s{one}R*(uáR,(	tassertFalsetttkt_format_optdicttTruetFalsetcopyRRtkeys(RRtoptst	orig_optstamount_opts((Rs9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_optdictsl& $





cCsid!d"d#gd6}tj|�}|jt|�t|j��d	�|j|d$�|jtj|dt�d%�|jtjigd	6�d&�id'gd6}tj|�}|j|d(�id)gd6}|jtj|�d*�id+gd6}|jttj|�idgddfgd6}|jttj|�iddggd6}|jtj|�d,�xOddt	dt
�fD]5}i|dfgd6}|jtj|�d-�q�Widd6}|jttj|�|jttjid.gd6�dS(/NR,tcRtdtothervalRtsingletais-as{b c} val d otherval {} singleR%s {{b c} val d otherval {} single}s-2uáuvãlu
üñíćódèu-üñíćódèuá vãluthitopts-opts{ } hiis	valid valt2tvalues1 valueis{} valuetinvalid(R,R8sval(R9R:(RR;(s-as{b c} val d otherval {} single(s-as {{b c} val d otherval {} single}(s-2R(uáuvãl(u-üñíćódèuá vãl(Rushi(s-opts{ } hi(iis	valid val(s-opts1 value(s-opts{} value(sinvalid(R.t_format_mapdictRRR3R0tassertRaisest	TypeErrortNoneR1tsett
IndexError(RR4RtvalidRAtstateval((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_mapdictts4& 
c
Cs�|jtjd�dd f�|jttjd�|jtjdtd�dd!f�|jtjdtdd"�dd#f�|jtjdtdd$�d	d%f�tjdtdd&dd
dd�}|j|dd
�|jt|d�dd
ddh�|jtjdt	dd'd
ddg�d(�|jt
tjd�|jtjdtdd�dd)f�|jtjdtddd*�dd+f�|jtjdtddd,dd
�dd-f�|jtjdt	ddddddgfdd
�d.�|jttjd�|jtjdtd�dd/f�|jtjdtdd�dd0f�|jtjdt	dd�d1�dS(2NtimageRstest RR<s	test {} aR,R8stest {a b} ctxtyistest a bis-as-bR9iis{test {a b c} d}s-x {2 3}tvsapisa b sa b {a b} cR>sa b a bs-opts{a b {a b} {1 2}}s-opt xtfroms{a}(((RR<((R<R,R8((R<R,(R<R,R8R9(s{test {a b c} d}s-x {2 3}((R<R,R8((R<R,(s-optRL(s{a b {a b} {1 2}}s-opt x((R,(s{a}R,(t
assertTrueR.t_format_elemcreateRERCRGRR1RFR0t
ValueError(Rtres((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_elemcreate�s<
&
"

cCspddd�}ddd�}|jtjg�dd�tjdgdd�}|j|tjdgdd��|j|dd�|j|�|��xRtd�D]D}|j||�||��|j|||�|||��q�W|jttjd	d
g�|jttjd�|jttjdg�|jttjdiidd6d
6fg�dS(NiicSsttjdidddgd6dididid	d
6fgd6dd6fgd6fgd6fgd
|d|�dS(NR<iiitotherR,R8R9R>tnicetchildrent	somethingtindenttindent_sizei(ii(R.t_format_layoutlist(RYRZ((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pytsample�s;cs_d�fd�}d|�||�|d|�|d|�|d|�||�|�fS(Nicsd|�S(NR
((tamount(RY(s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyt<lambda>�ssi%sa -other {1 2 3} -children {
%sb -children {
%sc -something {1 2} -children {
%sd -nice opt
%s}
%s}
%s}ii((RYRZtspaces((RYs9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pytsample_expected�s
RR<RYitbadtformatR,tnameRW(R<N(R<R(R<R,(	RR.R[RERRCRRRDtAttributeError(RR\R`tsmallestR((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_layoutlist�s$
	&
	cCs�|jtjiidd6dd6dd6d6��|jtjiidd6d6�d�itd6td6}|jtjii|d6d6��idgd
6}|jtjii|d6d6��|jt	tjiidgd6d6�|jtjiiddgd6d6��iidddgd6d6}|jtj|�d�|ddj
idd6�|jtj|�d�td�td�g|dddd<|jtj|�d�dS(Nt	configuretmapselement createRctlayoutsttk::style layout name {
null
}uαβγuáuvãlu
üñíćódèRKtstate1tstate2RtthingsAttk::style element create thing image {name {state1 state2} val} iR>sHttk::style element create thing image {name {state1 state2} val} -opt 30iRi�sLttk::style element create thing image {name {state1 state2} val} -opt {3 2m}(uáuvãl(RjRksval(R-R.t_script_from_settingsRERR0R1RPRCRGtappendR(Rt
configdicttmapdictRK((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_script_from_settingss4#		cCs�d}|jtj|t�idd6dd6�|jtj|�idd6dd6�|jtjd��tdd�}|jtjd|d	ff�idgd6�|jtjtd
�td�dtd
�gf�iddd
gd6�dS(Ns-as{1 2 3}s
-somethingtfooR<RXR;R,Rs-paddingt1it3miR(s-as{1 2 3}s
-somethingRr(ssingle(R<R,sval(RR.t_dict_from_tcltupleR1R-R
R(Rt
fakettupletsspec((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_dict_from_tcltuple<scs��fd�}td�td�D��}t|�}||dd|�||td�d|�td�td�D��}t|�}||dd|�|d
td�dd�dS(Ncs-�jtj||f�||fg�dS(N(RR.t_list_from_statespec(RwR@t	res_valuetstates(R(s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_itSscss|]}d|VqdS(sstate%dN((t.0R((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pys	<genexpr>WsiRcss|]}d|VqdS(sstate%dN((R}R((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pys	<genexpr>\siR<R,R8(R<R,R8(R<R,R8(ttupleRR
R(RR|tstates_event	statespect
states_odd((Rs9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_statespecRsc	Csi|jtjd��|jtjd�difg�d}|jtj|�didd6fg�|jtjdddf�digd6fg�ddddd	ddddff}|jtj|�didd6d	idd
6d
ifgd6fgd6fg�|jttjd�|jttjd�|jttjd�|jttjd�dS(NRcs-optionR@R(RXs	-childrenRWtniceonetotheronetchilds	-otheroptt
othervaluetotheropttno_minus((sname(snames-optionsvalue((R�(snameR�(snameR�svalue(s	somethings	-children(s	somethings	-childrensvalue(R-R.t_list_from_layouttupleRRCRR(Rt
sample_ltupletltuple((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_layouttuplecs0

$cCsbdd�}idd6}|jtj||�d�idd6}|jtj||�|�dS(NcSs|dkrdS||fS(Nstest val(RE(R>R((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pytfunc�sRstest vali(RERR.t_val_or_dict(RR�toptions((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_val_or_dict�s


cCs}d
ddd
gdfdf}x-|D]%\}}|jtj|�|�q%Wtj�dkry|jttjd	�ndS(Nit09i	R<uáÚs[]REtasciisá(ii(R�i	(R<R<(uáÚuáÚ(NsNone(RERR.t_convert_stringvaltsystgetdefaultencodingRCtUnicodeDecodeError(Rtteststorigtexpected((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_convert_stringval�s		(RRR7RJRTRfRqRxR�R�R�R�(((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyRs	X	)	=	7	+			.	
tTclObjsToPyTestcBs#eZd�Zd�Zd�ZRS(cCseidd6}|jtj|�idd6�t|d�|d<|jtj|�idd6�dS(NuvälúèR>(RR.t
tclobjs_to_pyR(Rtadict((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_unicode�s
 cCs�iddddgd6}|jtj|�iddddgd6�dddg|d<|jtj|�idddgd6�tdd�d	f|d<|jtj|�idgd6�|jtjid
gd6�id
gd6�dS(
NiiiiR>txmR<R,uválũèsy zRL(R<R,uválũè(RR.R�R
(RR�((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_multivalues�s,)cCs+|jtjidd6�idd6�dS(Ns	some textttext(RR.R�(R((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_nosplit�s(RRR�R�R�(((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyR��s		t__main__(trun_unittest(
R�tunittestR.tobjectRR
tTestCaseRR�ttests_noguiRttest.test_supportR�(((s9/sys/lib/python2.7/lib-tk/test/test_ttk/test_functions.pyt<module>s

�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.