7ec@sddlZddlZddlZdfdYZdefdYZdefdYZdejfd YZd ejfd YZ ee fZ e d krdd l m Z e e ndS(iNt MockTkAppcBseZdZdZRS(cCs t|tr|S|jdS(Nt:(t isinstancettupletsplit(tselftarg((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt splitlistscCstS(N(tTrue(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt wantobjects s(t__name__t __module__RR (((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs t MockTclObjcBs eZdZdZdZRS(ttestcCs ||_dS(N(tval(RR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt__init__scCs t|jS(N(tunicodeR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt__str__s(R R ttypenameRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR s t MockStateSpeccBs eZdZdZdZRS(t StateSpeccGs ||_dS(N(R(Rtargs((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRscCsdj|jS(Nt (tjoinR(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR!s(R R RRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs tInternalFunctionsTestcBsbeZdZdZdZdZdZdZdZdZ dZ d Z RS( cs fd}jtji|tjidd6ddddgd6idd 6d d 6|tjidBd6idd6|tjiidd6d6iidd6d6|tjiddd dd gd6dd6d d6dd6dd6dd6dd6dtid d6d!d"6dd#6d$d%6d&d'6d(d)6d*d+6itd,6td-6}|j}|tj|itd.6td/6j|||tjidCd26id3d46|tjidDd26id6d46|tjidEd26id8d46|tjidFd26id:d46|tjidGd26id=d46|tjidHd26id?d46ttj|d@d-d}j|t|dttj|d@dId}j|t|djtj|d@|jdS(JNcsfxEtdt|dD]+}j|j||||dqW|rbjd|ndS(Niiisresult still got elements: %s(trangetlent assertEqualtpoptfail(tfmt_optstresultti(R(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt check_against(s)tbluetfgiiiitpaddings-fgs1 2 3 4s-paddingtiR s1 2 {} 0s-testsas istleftit2mttest2ttest3sabc 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(iiR%i(sone twoR0(sone twoR0(R%R2(s one} {twoR0(s"one"R3(s{one}R3(uáR5( t assertFalsetttkt_format_optdictRtFalsetcopyRRtkeys(RR!toptst orig_optst amount_opts((Rs;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_optdict'sl&   $      cCsid!d"d#gd6}tj|}|jt|t|jd |j|d$|jtj|d td%|jtjigd 6d&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-qWidd6}|jttj||jt tjid.gd6dS(/NR5tcRtdtothervalR%tsingletais-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(R5R@R(RARB(R%RC(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(R%uRE(s-opts{ } hi(iis valid val(s-opts1 value(s-opts{} value(RI( R7t_format_mapdictRRR;Rt assertRaisest TypeErrortNoneR9tsett IndexError(RR<RtvalidRItstateval((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_mapdicts4&   c Cs|jtjddd f|jttjd|jtjdtddd!f|jtjdtdd"dd#f|jtjdtdd$d d%ftjdtdd&dd dd }|j|d d |jt|ddd dd h|jtjdt dd'd ddgd(|jt tjd|jtjdtdddd)f|jtjdtddd*dd+f|jtjdtddd,dd dd-f|jtjdt ddddddgfdd d.|jttjd|jtjdtddd/f|jtjdtdddd0f|jtjdt ddd1dS(2NtimageR stest R%RDs test {} aR5R@s test {a b} ctxtyistest a bis-as-bRAiis{test {a b c} d}s-x {2 3}tvsapisa b s a b {a b} cRFsa b a bs-opts{a b {a b} {1 2}}s-opt xtfroms{a}(((R%RD((RDR5R@((RDR5(RDR5R@RA(s{test {a b c} d}s-x {2 3}((RDR5R@((RDR5(s-optRT(s{a b {a b} {1 2}}s-opt x((R5(s{a}R5( t assertTrueR7t_format_elemcreateRMRKRORR9RNRt ValueError(Rtres((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_elemcreates< & "  cCspddd}ddd}|jtjgddtjdgdd}|j|tjdgdd|j|dd|j||xRtdD]D}|j|||||j||||||qW|jttjd d g|jttjd|jttjdg|jttjd iidd6d 6fgdS(Niic Ssttjdidddgd6dididid d 6fgd 6dd 6fgd 6fgd 6fgd |d|dS(NRDiiitotherR5R@RARFtnicetchildrent somethingtindentt indent_sizei(ii(R7t_format_layoutlist(RaRb((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytsamples ;cs_dfd}d||||d||d||d||||fS(Nics d|S(NR((tamount(Ra(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytR%si%sa -other {1 2 3} -children { %sb -children { %sc -something {1 2} -children { %sd -nice opt %s} %s} %s}ii((RaRbtspaces((Ras;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytsample_expecteds R%RDRaitbadtformatR5tnameR_(RDN(RDR%(RDR5( RR7RcRMRRKRZRLtAttributeError(RRdRhtsmallestR ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_format_layoutlists$  &  cCs|jtjiidd6dd6dd6d6|jtjiidd6d6ditd6td6}|jtjii|d6d6idgd 6}|jtjii|d6d6|jt tjiid gd6d6|jtjiid dgd6d6iid ddgd6d6}|jtj|d|ddj idd6|jtj|dt dt dg|dddd<|jtj|ddS(Nt configuretmapselement createRktlayoutsttk::style layout name { null }uαβγuáuvãlu üñíćódèRStstate1tstate2RtthingsAttk::style element create thing image {name {state1 state2} val} iRFsHttk::style element create thing image {name {state1 state2} val} -opt 30iR'isLttk::style element create thing image {name {state1 state2} val} -opt {3 2m}(uáuvãl(RrRsR( R6R7t_script_from_settingsRMRRR9RXRKROtappendR (Rt configdicttmapdictRS((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_script_from_settingss4#  cCsf|jtjtdddfdg|jtjtddtdgdddgdS( NRDR5Rt1it3mi(RDR5R(RR7t _tclobj_to_pyRR (R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_tclobj_to_pyGs  !csfd}tdtdD}t|}||dd|||tdd|tdtdD}t|}||dd||d tddd dS( Ncs-jtj||f||fgdS(N(RR7t_list_from_statespec(tsspecRHt res_valuetstates(R(s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_itQs css|]}d|VqdS(sstate%dN((t.0R ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pys UsiRcss|]}d|VqdS(sstate%dN((RR ((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pys ZsiRDR5R@(RDR5R@(RDR5R@(RRRR (RRt states_event statespect states_odd((Rs;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_statespecPs  c Cstt}|jtj|d|jtj|ddifgd}|jtj||didd6fg|jtj|dddfdigd6fgddddd ddd d ff}|jtj||didd6d id d 6d ifgd6fgd6fg|jttj|d|jttj|d|jttj|ddS(NRks-optionRHR1R`s -childrenR_tniceonetotheronetchilds -otheroptt othervaluetotheropttno_minus((Rk(Rks-optionRH((R(RkR(RkRRH(R`s -children(RR6R7t_list_from_layouttupleRRKRZ(Rttkt sample_ltupletltuple((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_list_from_layouttupleas.    $cCsddd}t}||_|jtj|ididd6|jtj|id idd6|jtj|idd6dd|jtj|idd6didd6dS( NcSs*|dkr|S|dkr dS||fS(Nstest val(RM(R[RFR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pytfuncs   s-test:3R/R s-testisx:ystest val(s-testi(RMRtcallRR7t _val_or_dict(RRR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_val_or_dicts  cCs}d d d d gdfdf}x-|D]%\}}|jtj||q%Wtjdkry|jttjd ndS(Nit09i RDuáÚs[]RMtasciisá(ii(Ri (RDRD(uáÚuáÚ(NRM(RMRR7t_convert_stringvaltsystgetdefaultencodingRKtUnicodeDecodeError(Rtteststorigtexpected((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_convert_stringvals  ( R R R?RRR\RnRyR}RRRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyR%s X ) = 7 +  . tTclObjsToPyTestcBs#eZdZdZdZRS(cCseidd6}|jtj|idd6t|d|d<|jtj|idd6dS(NuvälúèRF(RR7t tclobjs_to_pyR (Rtadict((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt test_unicodes  cCsiddddgd6}|jtj|iddddgd6dddg|d<|jtj|idddgd6tddd f|d<|jtj|id gd6|jtjid gd 6id gd 6dS( NiiiiRFtxmRDR5uválũèsy zRT(RDR5uválũè(RR7RR(RR((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyttest_multivaluess,)cCs+|jtjidd6idd6dS(Ns some textttext(RR7R(R((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyt test_nosplits(R R RRR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyRs  t__main__(t run_unittest(RtunittestR7RtobjectR RtTestCaseRRt tests_noguiR ttest.test_supportR(((s;/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.pyts