PK! __init__.pynu[PK!p __init__.pycnu[ zfc@sdS(N((((s5/usr/lib64/python2.7/lib-tk/test/test_ttk/__init__.pyttPK!p __init__.pyonu[ zfc@sdS(N((((s5/usr/lib64/python2.7/lib-tk/test/test_ttk/__init__.pyttPK!M,7 support.pynu[import functools import re import unittest import Tkinter as tkinter class AbstractTkTest: @classmethod def setUpClass(cls): cls._old_support_default_root = tkinter._support_default_root destroy_default_root() tkinter.NoDefaultRoot() cls.root = tkinter.Tk() cls.wantobjects = cls.root.wantobjects() # De-maximize main window. # Some window managers can maximize new windows. cls.root.wm_state('normal') try: cls.root.wm_attributes('-zoomed', False) except tkinter.TclError: pass @classmethod def tearDownClass(cls): cls.root.update_idletasks() cls.root.destroy() del cls.root tkinter._default_root = None tkinter._support_default_root = cls._old_support_default_root def setUp(self): self.root.deiconify() def tearDown(self): for w in self.root.winfo_children(): w.destroy() self.root.withdraw() def destroy_default_root(): if getattr(tkinter, '_default_root', None): tkinter._default_root.update_idletasks() tkinter._default_root.destroy() tkinter._default_root = None def simulate_mouse_click(widget, x, y): """Generate proper events to click at the x, y position (tries to act like an X server).""" widget.event_generate('', x=0, y=0) widget.event_generate('', x=x, y=y) widget.event_generate('', x=x, y=y) widget.event_generate('', x=x, y=y) import _tkinter tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.'))) def requires_tcl(*version): if len(version) <= 2: return unittest.skipUnless(tcl_version >= version, 'requires Tcl version >= ' + '.'.join(map(str, version))) def deco(test): @functools.wraps(test) def newtest(self): if get_tk_patchlevel() < version: self.skipTest('requires Tcl version >= ' + '.'.join(map(str, version))) test(self) return newtest return deco _tk_patchlevel = None def get_tk_patchlevel(): global _tk_patchlevel if _tk_patchlevel is None: tcl = tkinter.Tcl() patchlevel = tcl.call('info', 'patchlevel') m = re.match(r'(\d+)\.(\d+)([ab.])(\d+)$', patchlevel) major, minor, releaselevel, serial = m.groups() major, minor, serial = int(major), int(minor), int(serial) releaselevel = {'a': 'alpha', 'b': 'beta', '.': 'final'}[releaselevel] if releaselevel == 'final': _tk_patchlevel = major, minor, serial, releaselevel, 0 else: _tk_patchlevel = major, minor, 0, releaselevel, serial return _tk_patchlevel units = { 'c': 72 / 2.54, # centimeters 'i': 72, # inches 'm': 72 / 25.4, # millimeters 'p': 1, # points } def pixels_conv(value): return float(value[:-1]) * units[value[-1:]] def tcl_obj_eq(actual, expected): if actual == expected: return True if isinstance(actual, _tkinter.Tcl_Obj): if isinstance(expected, str): return str(actual) == expected if isinstance(actual, tuple): if isinstance(expected, tuple): return (len(actual) == len(expected) and all(tcl_obj_eq(act, exp) for act, exp in zip(actual, expected))) return False def widget_eq(actual, expected): if actual == expected: return True if isinstance(actual, (str, tkinter.Widget)): if isinstance(expected, (str, tkinter.Widget)): return str(actual) == str(expected) return False PK!@ S support.pycnu[ zfc@sddlZddlZddlZddlZdddYZdZdZddlZe e e ej j dZdZdadZid d d 6d d 6d d d6dd6ZdZdZdZdS(iNtAbstractTkTestcBs8eZedZedZdZdZRS(cCstj|_ttjtj|_|jj|_|jjdy|jj dt Wntj k r{nXdS(Ntnormals-zoomed( ttkintert_support_default_roott_old_support_default_roottdestroy_default_roott NoDefaultRoottTktroott wantobjectstwm_statet wm_attributestFalsetTclError(tcls((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt setUpClasss  cCs9|jj|jj|`dt_|jt_dS(N(Rtupdate_idletaskstdestroytNoneRt _default_rootRR(R((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt tearDownClasss    cCs|jjdS(N(Rt deiconify(tself((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsetUpscCs5x!|jjD]}|jqW|jjdS(N(Rtwinfo_childrenRtwithdraw(Rtw((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyttearDown"s(t__name__t __module__t classmethodRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRs cCs<ttddr8tjjtjjdt_ndS(NR(tgetattrRRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR's  cCsh|jddddd|jdd|d||jdd|d||jdd|d|dS( sYGenerate proper events to click at the x, y position (tries to act like an X server).stxitysssN(tevent_generate(twidgetR R!((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsimulate_mouse_click-st.csQtdkr>tjtkddjttSfd}|S(Nisrequires Tcl version >= R%cs%tjfd}|S(NcsCtkr5|jddjttn|dS(Nsrequires Tcl version >= R%(tget_tk_patchleveltskipTesttjointmaptstr(R(ttesttversion(s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytnewtest?s (t functoolstwraps(R+R-(R,(R+s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytdeco>s!(tlentunittestt skipUnlesst tcl_versionR(R)R*(R,R0((R,s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt requires_tcl9s cCstdkrtj}|jdd}tjd|}|j\}}}}t|t|t|}}}idd6dd6dd 6|}|dkr||||d faq||d ||fantS( Ntinfot patchlevels(\d+)\.(\d+)([ab.])(\d+)$talphatatbetatbtfinalR%i( t_tk_patchlevelRRtTcltcalltretmatchtgroupstint(ttclR7tmtmajortminort releaseleveltserial((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR&Is  & iHgRQ@tctigffffff9@REitpcCst|d t|dS(Ni(tfloattunits(tvalue((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt pixels_conv_scCs||krtSt|tjrDt|trDt||kSnt|trt|trt|t|kotdt||DSnt S(Ncss$|]\}}t||VqdS(N(t tcl_obj_eq(t.0tacttexp((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pys ks( tTruet isinstancet_tkintertTcl_ObjR*ttupleR1talltzipR (tactualtexpected((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRQbs  cCs]||krtSt|ttjfrYt|ttjfrYt|t|kSntS(N(RURVR*RtWidgetR (R\R]((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt widget_eqos  ((R.R@R2tTkinterRRRR$RWRYR)RCt TCL_VERSIONtsplitR4R5RR=R&RNRPRQR_(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyts&    !  !       PK!@ S support.pyonu[ zfc@sddlZddlZddlZddlZdddYZdZdZddlZe e e ej j dZdZdadZid d d 6d d 6d d d6dd6ZdZdZdZdS(iNtAbstractTkTestcBs8eZedZedZdZdZRS(cCstj|_ttjtj|_|jj|_|jjdy|jj dt Wntj k r{nXdS(Ntnormals-zoomed( ttkintert_support_default_roott_old_support_default_roottdestroy_default_roott NoDefaultRoottTktroott wantobjectstwm_statet wm_attributestFalsetTclError(tcls((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt setUpClasss  cCs9|jj|jj|`dt_|jt_dS(N(Rtupdate_idletaskstdestroytNoneRt _default_rootRR(R((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt tearDownClasss    cCs|jjdS(N(Rt deiconify(tself((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsetUpscCs5x!|jjD]}|jqW|jjdS(N(Rtwinfo_childrenRtwithdraw(Rtw((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyttearDown"s(t__name__t __module__t classmethodRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRs cCs<ttddr8tjjtjjdt_ndS(NR(tgetattrRRRRR(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR's  cCsh|jddddd|jdd|d||jdd|d||jdd|d|dS( sYGenerate proper events to click at the x, y position (tries to act like an X server).stxitysssN(tevent_generate(twidgetR R!((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytsimulate_mouse_click-st.csQtdkr>tjtkddjttSfd}|S(Nisrequires Tcl version >= R%cs%tjfd}|S(NcsCtkr5|jddjttn|dS(Nsrequires Tcl version >= R%(tget_tk_patchleveltskipTesttjointmaptstr(R(ttesttversion(s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytnewtest?s (t functoolstwraps(R+R-(R,(R+s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pytdeco>s!(tlentunittestt skipUnlesst tcl_versionR(R)R*(R,R0((R,s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt requires_tcl9s cCstdkrtj}|jdd}tjd|}|j\}}}}t|t|t|}}}idd6dd6dd 6|}|dkr||||d faq||d ||fantS( Ntinfot patchlevels(\d+)\.(\d+)([ab.])(\d+)$talphatatbetatbtfinalR%i( t_tk_patchlevelRRtTcltcalltretmatchtgroupstint(ttclR7tmtmajortminort releaseleveltserial((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyR&Is  & iHgRQ@tctigffffff9@REitpcCst|d t|dS(Ni(tfloattunits(tvalue((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt pixels_conv_scCs||krtSt|tjrDt|trDt||kSnt|trt|trt|t|kotdt||DSnt S(Ncss$|]\}}t||VqdS(N(t tcl_obj_eq(t.0tacttexp((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pys ks( tTruet isinstancet_tkintertTcl_ObjR*ttupleR1talltzipR (tactualtexpected((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyRQbs  cCs]||krtSt|ttjfrYt|ttjfrYt|t|kSntS(N(RURVR*RtWidgetR (R\R]((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyt widget_eqos  ((R.R@R2tTkinterRRRR$RWRYR)RCt TCL_VERSIONtsplitR4R5RR=R&RNRPRQR_(((s4/usr/lib64/python2.7/lib-tk/test/test_ttk/support.pyts&    !  !       PK!B,,test_extensions.pynu[import sys import unittest import Tkinter as tkinter import ttk from test.test_support import requires, run_unittest, swap_attr from test_ttk.support import AbstractTkTest, destroy_default_root requires('gui') class LabeledScaleTest(AbstractTkTest, unittest.TestCase): def tearDown(self): self.root.update_idletasks() super(LabeledScaleTest, self).tearDown() def test_widget_destroy(self): # automatically created variable x = ttk.LabeledScale(self.root) var = x._variable._name x.destroy() self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var) # manually created variable myvar = tkinter.DoubleVar(self.root) name = myvar._name x = ttk.LabeledScale(self.root, variable=myvar) x.destroy() if self.wantobjects: self.assertEqual(x.tk.globalgetvar(name), myvar.get()) else: self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get()) del myvar self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name) # checking that the tracing callback is properly removed myvar = tkinter.IntVar(self.root) # LabeledScale will start tracing myvar x = ttk.LabeledScale(self.root, variable=myvar) x.destroy() # Unless the tracing callback was removed, creating a new # LabeledScale with the same var will cause an error now. This # happens because the variable will be set to (possibly) a new # value which causes the tracing callback to be called and then # it tries calling instance attributes not yet defined. ttk.LabeledScale(self.root, variable=myvar) if hasattr(sys, 'last_type'): self.assertNotEqual(sys.last_type, tkinter.TclError) def test_initialization_no_master(self): # no master passing with swap_attr(tkinter, '_default_root', None), \ swap_attr(tkinter, '_support_default_root', True): try: x = ttk.LabeledScale() self.assertIsNotNone(tkinter._default_root) self.assertEqual(x.master, tkinter._default_root) self.assertEqual(x.tk, tkinter._default_root.tk) x.destroy() finally: destroy_default_root() def test_initialization(self): # master passing master = tkinter.Frame(self.root) x = ttk.LabeledScale(master) self.assertEqual(x.master, master) x.destroy() # variable initialization/passing passed_expected = (('0', 0), (0, 0), (10, 10), (-1, -1), (sys.maxint + 1, sys.maxint + 1)) if self.wantobjects: passed_expected += ((2.5, 2),) for pair in passed_expected: x = ttk.LabeledScale(self.root, from_=pair[0]) self.assertEqual(x.value, pair[1]) x.destroy() x = ttk.LabeledScale(self.root, from_='2.5') self.assertRaises(ValueError, x._variable.get) x.destroy() x = ttk.LabeledScale(self.root, from_=None) self.assertRaises(ValueError, x._variable.get) x.destroy() # variable should have its default value set to the from_ value myvar = tkinter.DoubleVar(self.root, value=20) x = ttk.LabeledScale(self.root, variable=myvar) self.assertEqual(x.value, 0) x.destroy() # check that it is really using a DoubleVar x = ttk.LabeledScale(self.root, variable=myvar, from_=0.5) self.assertEqual(x.value, 0.5) self.assertEqual(x._variable._name, myvar._name) x.destroy() # widget positionment def check_positions(scale, scale_pos, label, label_pos): self.assertEqual(scale.pack_info()['side'], scale_pos) self.assertEqual(label.place_info()['anchor'], label_pos) x = ttk.LabeledScale(self.root, compound='top') check_positions(x.scale, 'bottom', x.label, 'n') x.destroy() x = ttk.LabeledScale(self.root, compound='bottom') check_positions(x.scale, 'top', x.label, 's') x.destroy() # invert default positions x = ttk.LabeledScale(self.root, compound='unknown') check_positions(x.scale, 'top', x.label, 's') x.destroy() x = ttk.LabeledScale(self.root) # take default positions check_positions(x.scale, 'bottom', x.label, 'n') x.destroy() # extra, and invalid, kwargs self.assertRaises(tkinter.TclError, ttk.LabeledScale, master, a='b') def test_horizontal_range(self): lscale = ttk.LabeledScale(self.root, from_=0, to=10) lscale.pack() lscale.wait_visibility() lscale.update() linfo_1 = lscale.label.place_info() prev_xcoord = lscale.scale.coords()[0] self.assertEqual(prev_xcoord, int(linfo_1['x'])) # change range to: from -5 to 5. This should change the x coord of # the scale widget, since 0 is at the middle of the new # range. lscale.scale.configure(from_=-5, to=5) # The following update is needed since the test doesn't use mainloop, # at the same time this shouldn't affect test outcome lscale.update() curr_xcoord = lscale.scale.coords()[0] self.assertNotEqual(prev_xcoord, curr_xcoord) # the label widget should have been repositioned too linfo_2 = lscale.label.place_info() self.assertEqual(lscale.label['text'], 0 if self.wantobjects else '0') self.assertEqual(curr_xcoord, int(linfo_2['x'])) # change the range back lscale.scale.configure(from_=0, to=10) self.assertNotEqual(prev_xcoord, curr_xcoord) self.assertEqual(prev_xcoord, int(linfo_1['x'])) lscale.destroy() def test_variable_change(self): x = ttk.LabeledScale(self.root) x.pack() x.wait_visibility() x.update() curr_xcoord = x.scale.coords()[0] newval = x.value + 1 x.value = newval # The following update is needed since the test doesn't use mainloop, # at the same time this shouldn't affect test outcome x.update() self.assertEqual(x.label['text'], newval if self.wantobjects else str(newval)) self.assertGreater(x.scale.coords()[0], curr_xcoord) self.assertEqual(x.scale.coords()[0], int(x.label.place_info()['x'])) # value outside range if self.wantobjects: conv = lambda x: x else: conv = int x.value = conv(x.scale['to']) + 1 # no changes shouldn't happen x.update() self.assertEqual(conv(x.label['text']), newval) self.assertEqual(x.scale.coords()[0], int(x.label.place_info()['x'])) x.destroy() def test_resize(self): x = ttk.LabeledScale(self.root) x.pack(expand=True, fill='both') x.wait_visibility() x.update() width, height = x.master.winfo_width(), x.master.winfo_height() width_new, height_new = width * 2, height * 2 x.value = 3 x.update() x.master.wm_geometry("%dx%d" % (width_new, height_new)) self.assertEqual(int(x.label.place_info()['x']), x.scale.coords()[0]) # Reset geometry x.master.wm_geometry("%dx%d" % (width, height)) x.destroy() class OptionMenuTest(AbstractTkTest, unittest.TestCase): def setUp(self): super(OptionMenuTest, self).setUp() self.textvar = tkinter.StringVar(self.root) def tearDown(self): del self.textvar super(OptionMenuTest, self).tearDown() def test_widget_destroy(self): var = tkinter.StringVar(self.root) optmenu = ttk.OptionMenu(self.root, var) name = var._name optmenu.update_idletasks() optmenu.destroy() self.assertEqual(optmenu.tk.globalgetvar(name), var.get()) del var self.assertRaises(tkinter.TclError, optmenu.tk.globalgetvar, name) def test_initialization(self): self.assertRaises(tkinter.TclError, ttk.OptionMenu, self.root, self.textvar, invalid='thing') optmenu = ttk.OptionMenu(self.root, self.textvar, 'b', 'a', 'b') self.assertEqual(optmenu._variable.get(), 'b') self.assertTrue(optmenu['menu']) self.assertTrue(optmenu['textvariable']) optmenu.destroy() def test_menu(self): items = ('a', 'b', 'c') default = 'a' optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items) found_default = False for i in range(len(items)): value = optmenu['menu'].entrycget(i, 'value') self.assertEqual(value, items[i]) if value == default: found_default = True self.assertTrue(found_default) optmenu.destroy() # default shouldn't be in menu if it is not part of values default = 'd' optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items) curr = None i = 0 while True: last, curr = curr, optmenu['menu'].entryconfigure(i, 'value') if last == curr: # no more menu entries break self.assertNotEqual(curr, default) i += 1 self.assertEqual(i, len(items)) # check that variable is updated correctly optmenu.pack() optmenu.wait_visibility() optmenu['menu'].invoke(0) self.assertEqual(optmenu._variable.get(), items[0]) # changing to an invalid index shouldn't change the variable self.assertRaises(tkinter.TclError, optmenu['menu'].invoke, -1) self.assertEqual(optmenu._variable.get(), items[0]) optmenu.destroy() # specifying a callback success = [] def cb_test(item): self.assertEqual(item, items[1]) success.append(True) optmenu = ttk.OptionMenu(self.root, self.textvar, 'a', command=cb_test, *items) optmenu['menu'].invoke(1) if not success: self.fail("Menu callback not invoked") optmenu.destroy() def test_unique_radiobuttons(self): # check that radiobuttons are unique across instances (bpo25684) items = ('a', 'b', 'c') default = 'a' optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items) textvar2 = tkinter.StringVar(self.root) optmenu2 = ttk.OptionMenu(self.root, textvar2, default, *items) optmenu.pack() optmenu.wait_visibility() optmenu2.pack() optmenu2.wait_visibility() optmenu['menu'].invoke(1) optmenu2['menu'].invoke(2) optmenu_stringvar_name = optmenu['menu'].entrycget(0, 'variable') optmenu2_stringvar_name = optmenu2['menu'].entrycget(0, 'variable') self.assertNotEqual(optmenu_stringvar_name, optmenu2_stringvar_name) self.assertEqual(self.root.tk.globalgetvar(optmenu_stringvar_name), items[1]) self.assertEqual(self.root.tk.globalgetvar(optmenu2_stringvar_name), items[2]) optmenu.destroy() optmenu2.destroy() tests_gui = (LabeledScaleTest, OptionMenuTest) if __name__ == "__main__": run_unittest(*tests_gui) PK!ž''test_extensions.pycnu[ zfc@sddlZddlZddlZddlZddlmZmZmZddl m Z m Z edde ej fdYZ de ej fdYZe efZed kreendS( iN(trequirest run_unittestt swap_attr(tAbstractTkTesttdestroy_default_roottguitLabeledScaleTestcBsGeZdZdZdZdZdZdZdZRS(cCs$|jjtt|jdS(N(troottupdate_idletaskstsuperRttearDown(tself((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR s cCsltj|j}|jj}|j|jtj|j j |tj |j}|j}tj|jd|}|j|j r|j |j j ||jn(|j t|j j ||j~|jtj|j j |tj|j}tj|jd|}|jtj|jd|ttdrh|jtjtjndS(Ntvariablet last_type(tttkt LabeledScaleRt _variablet_nametdestroyt assertRaisesttkintertTclErrorttkt globalgetvart DoubleVart wantobjectst assertEqualtgettfloattIntVarthasattrtsystassertNotEqualR (R txtvartmyvartname((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_widget_destroys&     %( c CsttddttdtizYtj}|jtj|j|j tj|j|j tjj |j Wdt XWdQXWdQXdS(Nt _default_roott_support_default_root( RRtNonetTrueRRtassertIsNotNoneR&RtmasterRRR(R R!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization_no_master2s cstjj}tj|}j|j||jddddtj dtj dff}j r}|d7}nxK|D]C}tjjd|d}j|j |d|jqWtjjdd }j t |jj|jtjjdd}j t |jj|jtjjd d }tjjd |}j|j d|jtjjd |dd }j|j d j|jj|j|jfd}tjjdd}||jd|jd|jtjjdd}||jd|jd|jtjjdd}||jd|jd|jtjj}||jd|jd|jj tjtj|dddS(Nt0ii iig@itfrom_s2.5tvalueiR g?cs8j|jd|j|jd|dS(Ntsidetanchor(Rt pack_infot place_info(tscalet scale_postlabelt label_pos(R (s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcheck_positionsastcompoundttoptbottomtntstunknowntatb(R-i(ii(i i (ii(g@i((g@i(RtFrameRRRRR+RRtmaxintRR/Rt ValueErrorRRR(RRR4R6R(R R+R!tpassed_expectedtpairR#R8((R s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization?sP              cCs^tj|jdddd}|j|j|j|jj}|jj d}|j |t |d|jj dddd|j|jj d}|j |||jj}|j |jd|jrdnd |j |t |d|jj dddd|j |||j |t |d|jdS( NR.ittoi R!iittextR-(RRRtpacktwait_visibilitytupdateR6R3R4tcoordsRtintt configureR RR(R tlscaletlinfo_1t prev_xcoordt curr_xcoordtlinfo_2((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_horizontal_rangevs$    &cCsvtj|j}|j|j|j|jjd}|jd}||_|j|j |j d|j r|n t ||j |jjd||j |jjdt|j jd|j rd}nt}||jdd|_|j|j ||j d||j |jjdt|j jd|jdS(NiiRHR!cSs|S(N((R!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttRG(RRRRIRJRKR4RLR/RR6Rtstrt assertGreaterRMR3R(R R!RRtnewvaltconv((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_variable_changes,         cCstj|j}|jdtdd|j|j|jj|jj }}|d|d}}d|_ |j|jj d||f|j t |jjd|jjd|jj d||f|jdS( Ntexpandtfilltbothiis%dx%dR!i(RRRRIR)RJRKR+t winfo_widtht winfo_heightR/t wm_geometryRRMR6R3R4RLR(R R!twidththeightt width_newt height_new((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt test_resizes    ( t__name__t __module__R R%R,RFRTR[Rf(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR s  " 7  tOptionMenuTestcBs>eZdZdZdZdZdZdZRS(cCs,tt|jtj|j|_dS(N(R RitsetUpRt StringVarRttextvar(R ((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRjscCs|`tt|jdS(N(RlR RiR (R ((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR scCstj|j}tj|j|}|j}|j|j|j|j j ||j ~|j tj |j j |dS(N(RRkRRt OptionMenuRRRRRRRRR(R R"toptmenuR$((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR%s   "cCs|jtjtj|j|jddtj|j|jddd}|j|jj d|j |d|j |d|j dS(NtinvalidtthingR@R?tmenut textvariable( RRRRRmRRlRRRt assertTrueR(R Rn((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRFs !c s7d d}tjjj|}t}xYttD]E}|dj|d}j||||krCt }qCqCWj ||j d}tjjj|}d}d}xQt r&||dj |d}}||kr Pnj|||d7}qWj|t|j|j|djdj|jjdjtj|djd j|jjd|j gfd }tjjjdd |}|djds)jd n|j dS(NR?R@tcRqR/tdiiics%j|djtdS(Ni(RtappendR)(titem(titemsR tsuccess(s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcb_teststcommandsMenu callback not invoked(R?R@Rt(RRmRRltFalsetrangetlent entrycgetRR)RsRR(tentryconfigureR RIRJtinvokeRRRRRtfail( R tdefaultRnt found_defaulttiR/tcurrtlastRz((RxR Rys</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt test_menusJ          cCs;d }d}tj|j|j||}tj|j}tj|j|||}|j|j|j|j|djd|djd|dj dd}|dj dd}|j |||j |jj j ||d|j |jj j ||d|j|jdS( NR?R@RtRqiiiR (R?R@Rt(RRmRRlRRkRIRJRRR RRRR(R RxRRnttextvar2toptmenu2toptmenu_stringvar_nametoptmenu2_stringvar_name((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_unique_radiobuttonss*        (RgRhRjR R%RFRR(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRis    4t__main__(RtunittesttTkinterRRttest.test_supportRRRttest_ttk.supportRRtTestCaseRRit tests_guiRg(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyts     q  PK!ž''test_extensions.pyonu[ zfc@sddlZddlZddlZddlZddlmZmZmZddl m Z m Z edde ej fdYZ de ej fdYZe efZed kreendS( iN(trequirest run_unittestt swap_attr(tAbstractTkTesttdestroy_default_roottguitLabeledScaleTestcBsGeZdZdZdZdZdZdZdZRS(cCs$|jjtt|jdS(N(troottupdate_idletaskstsuperRttearDown(tself((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR s cCsltj|j}|jj}|j|jtj|j j |tj |j}|j}tj|jd|}|j|j r|j |j j ||jn(|j t|j j ||j~|jtj|j j |tj|j}tj|jd|}|jtj|jd|ttdrh|jtjtjndS(Ntvariablet last_type(tttkt LabeledScaleRt _variablet_nametdestroyt assertRaisesttkintertTclErrorttkt globalgetvart DoubleVart wantobjectst assertEqualtgettfloattIntVarthasattrtsystassertNotEqualR (R txtvartmyvartname((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_widget_destroys&     %( c CsttddttdtizYtj}|jtj|j|j tj|j|j tjj |j Wdt XWdQXWdQXdS(Nt _default_roott_support_default_root( RRtNonetTrueRRtassertIsNotNoneR&RtmasterRRR(R R!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization_no_master2s cstjj}tj|}j|j||jddddtj dtj dff}j r}|d7}nxK|D]C}tjjd|d}j|j |d|jqWtjjdd }j t |jj|jtjjdd}j t |jj|jtjjd d }tjjd |}j|j d|jtjjd |dd }j|j d j|jj|j|jfd}tjjdd}||jd|jd|jtjjdd}||jd|jd|jtjjdd}||jd|jd|jtjj}||jd|jd|jj tjtj|dddS(Nt0ii iig@itfrom_s2.5tvalueiR g?cs8j|jd|j|jd|dS(Ntsidetanchor(Rt pack_infot place_info(tscalet scale_postlabelt label_pos(R (s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcheck_positionsastcompoundttoptbottomtntstunknowntatb(R-i(ii(i i (ii(g@i((g@i(RtFrameRRRRR+RRtmaxintRR/Rt ValueErrorRRR(RRR4R6R(R R+R!tpassed_expectedtpairR#R8((R s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_initialization?sP              cCs^tj|jdddd}|j|j|j|jj}|jj d}|j |t |d|jj dddd|j|jj d}|j |||jj}|j |jd|jrdnd |j |t |d|jj dddd|j |||j |t |d|jdS( NR.ittoi R!iittextR-(RRRtpacktwait_visibilitytupdateR6R3R4tcoordsRtintt configureR RR(R tlscaletlinfo_1t prev_xcoordt curr_xcoordtlinfo_2((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_horizontal_rangevs$    &cCsvtj|j}|j|j|j|jjd}|jd}||_|j|j |j d|j r|n t ||j |jjd||j |jjdt|j jd|j rd}nt}||jdd|_|j|j ||j d||j |jjdt|j jd|jdS(NiiRHR!cSs|S(N((R!((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttRG(RRRRIRJRKR4RLR/RR6Rtstrt assertGreaterRMR3R(R R!RRtnewvaltconv((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_variable_changes,         cCstj|j}|jdtdd|j|j|jj|jj }}|d|d}}d|_ |j|jj d||f|j t |jjd|jjd|jj d||f|jdS( Ntexpandtfilltbothiis%dx%dR!i(RRRRIR)RJRKR+t winfo_widtht winfo_heightR/t wm_geometryRRMR6R3R4RLR(R R!twidththeightt width_newt height_new((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt test_resizes    ( t__name__t __module__R R%R,RFRTR[Rf(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR s  " 7  tOptionMenuTestcBs>eZdZdZdZdZdZdZRS(cCs,tt|jtj|j|_dS(N(R RitsetUpRt StringVarRttextvar(R ((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRjscCs|`tt|jdS(N(RlR RiR (R ((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR scCstj|j}tj|j|}|j}|j|j|j|j j ||j ~|j tj |j j |dS(N(RRkRRt OptionMenuRRRRRRRRR(R R"toptmenuR$((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyR%s   "cCs|jtjtj|j|jddtj|j|jddd}|j|jj d|j |d|j |d|j dS(NtinvalidtthingR@R?tmenut textvariable( RRRRRmRRlRRRt assertTrueR(R Rn((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRFs !c s7d d}tjjj|}t}xYttD]E}|dj|d}j||||krCt }qCqCWj ||j d}tjjj|}d}d}xQt r&||dj |d}}||kr Pnj|||d7}qWj|t|j|j|djdj|jjdjtj|djd j|jjd|j gfd }tjjjdd |}|djds)jd n|j dS(NR?R@tcRqR/tdiiics%j|djtdS(Ni(RtappendR)(titem(titemsR tsuccess(s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pytcb_teststcommandsMenu callback not invoked(R?R@Rt(RRmRRltFalsetrangetlent entrycgetRR)RsRR(tentryconfigureR RIRJtinvokeRRRRRtfail( R tdefaultRnt found_defaulttiR/tcurrtlastRz((RxR Rys</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyt test_menusJ          cCs;d }d}tj|j|j||}tj|j}tj|j|||}|j|j|j|j|djd|djd|dj dd}|dj dd}|j |||j |jj j ||d|j |jj j ||d|j|jdS( NR?R@RtRqiiiR (R?R@Rt(RRmRRlRRkRIRJRRR RRRR(R RxRRnttextvar2toptmenu2toptmenu_stringvar_nametoptmenu2_stringvar_name((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyttest_unique_radiobuttonss*        (RgRhRjR R%RFRR(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyRis    4t__main__(RtunittesttTkinterRRttest.test_supportRRRttest_ttk.supportRRtTestCaseRRit tests_guiRg(((s</usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.pyts     q  PK!GCCtest_functions.pynu[# -*- encoding: utf-8 -*- import sys import unittest import ttk class MockTkApp: def splitlist(self, arg): if isinstance(arg, tuple): return arg return arg.split(':') def wantobjects(self): return True class MockTclObj(object): typename = 'test' def __init__(self, val): self.val = val def __str__(self): return unicode(self.val) class MockStateSpec(object): typename = 'StateSpec' def __init__(self, *args): self.val = args def __str__(self): return ' '.join(self.val) class InternalFunctionsTest(unittest.TestCase): def test_format_optdict(self): def check_against(fmt_opts, result): for i in range(0, len(fmt_opts), 2): self.assertEqual(result.pop(fmt_opts[i]), fmt_opts[i + 1]) if result: self.fail("result still got elements: %s" % result) # passing an empty dict should return an empty object (tuple here) self.assertFalse(ttk._format_optdict({})) # check list formatting check_against( ttk._format_optdict({'fg': 'blue', 'padding': [1, 2, 3, 4]}), {'-fg': 'blue', '-padding': '1 2 3 4'}) # check tuple formatting (same as list) check_against( ttk._format_optdict({'test': (1, 2, '', 0)}), {'-test': '1 2 {} 0'}) # check untouched values check_against( ttk._format_optdict({'test': {'left': 'as is'}}), {'-test': {'left': 'as is'}}) # check script formatting check_against( ttk._format_optdict( {'test': [1, -1, '', '2m', 0], 'test2': 3, 'test3': '', 'test4': 'abc def', 'test5': '"abc"', 'test6': '{}', 'test7': '} -spam {'}, script=True), {'-test': '{1 -1 {} 2m 0}', '-test2': '3', '-test3': '{}', '-test4': '{abc def}', '-test5': '{"abc"}', '-test6': r'\{\}', '-test7': r'\}\ -spam\ \{'}) opts = {u'αβγ': True, u'á': False} orig_opts = opts.copy() # check if giving unicode keys is fine check_against(ttk._format_optdict(opts), {u'-αβγ': True, u'-á': False}) # opts should remain unchanged self.assertEqual(opts, orig_opts) # passing values with spaces inside a tuple/list check_against( ttk._format_optdict( {'option': ('one two', 'three')}), {'-option': '{one two} three'}) check_against( ttk._format_optdict( {'option': ('one\ttwo', 'three')}), {'-option': '{one\ttwo} three'}) # passing empty strings inside a tuple/list check_against( ttk._format_optdict( {'option': ('', 'one')}), {'-option': '{} one'}) # passing values with braces inside a tuple/list check_against( ttk._format_optdict( {'option': ('one} {two', 'three')}), {'-option': r'one\}\ \{two three'}) # passing quoted strings inside a tuple/list check_against( ttk._format_optdict( {'option': ('"one"', 'two')}), {'-option': '{"one"} two'}) check_against( ttk._format_optdict( {'option': ('{one}', 'two')}), {'-option': r'\{one\} two'}) # ignore an option amount_opts = len(ttk._format_optdict(opts, ignore=(u'á'))) // 2 self.assertEqual(amount_opts, len(opts) - 1) # ignore non-existing options amount_opts = len(ttk._format_optdict(opts, ignore=(u'á', 'b'))) // 2 self.assertEqual(amount_opts, len(opts) - 1) # ignore every option self.assertFalse(ttk._format_optdict(opts, ignore=opts.keys())) def test_format_mapdict(self): opts = {'a': [('b', 'c', 'val'), ('d', 'otherval'), ('', 'single')]} result = ttk._format_mapdict(opts) self.assertEqual(len(result), len(opts.keys()) * 2) self.assertEqual(result, ('-a', '{b c} val d otherval {} single')) self.assertEqual(ttk._format_mapdict(opts, script=True), ('-a', '{{b c} val d otherval {} single}')) self.assertEqual(ttk._format_mapdict({2: []}), ('-2', '')) opts = {u'üñíćódè': [(u'á', u'vãl')]} result = ttk._format_mapdict(opts) self.assertEqual(result, (u'-üñíćódè', u'á vãl')) # empty states valid = {'opt': [('', u'', 'hi')]} self.assertEqual(ttk._format_mapdict(valid), ('-opt', '{ } hi')) # when passing multiple states, they all must be strings invalid = {'opt': [(1, 2, 'valid val')]} self.assertRaises(TypeError, ttk._format_mapdict, invalid) invalid = {'opt': [([1], '2', 'valid val')]} self.assertRaises(TypeError, ttk._format_mapdict, invalid) # but when passing a single state, it can be anything valid = {'opt': [[1, 'value']]} self.assertEqual(ttk._format_mapdict(valid), ('-opt', '1 value')) # special attention to single states which evalute to False for stateval in (None, 0, False, '', set()): # just some samples valid = {'opt': [(stateval, 'value')]} self.assertEqual(ttk._format_mapdict(valid), ('-opt', '{} value')) # values must be iterable opts = {'a': None} self.assertRaises(TypeError, ttk._format_mapdict, opts) # items in the value must have size >= 2 self.assertRaises(IndexError, ttk._format_mapdict, {'a': [('invalid', )]}) def test_format_elemcreate(self): self.assertTrue(ttk._format_elemcreate(None), (None, ())) ## Testing type = image # image type expects at least an image name, so this should raise # IndexError since it tries to access the index 0 of an empty tuple self.assertRaises(IndexError, ttk._format_elemcreate, 'image') # don't format returned values as a tcl script # minimum acceptable for image type self.assertEqual(ttk._format_elemcreate('image', False, 'test'), ("test ", ())) # specifying a state spec self.assertEqual(ttk._format_elemcreate('image', False, 'test', ('', 'a')), ("test {} a", ())) # state spec with multiple states self.assertEqual(ttk._format_elemcreate('image', False, 'test', ('a', 'b', 'c')), ("test {a b} c", ())) # state spec and options res = ttk._format_elemcreate('image', False, 'test', ('a', 'b'), a='x', b='y') self.assertEqual(res[0], "test a b") self.assertEqual(set(res[1]), {"-a", "x", "-b", "y"}) # format returned values as a tcl script # state spec with multiple states and an option with a multivalue self.assertEqual(ttk._format_elemcreate('image', True, 'test', ('a', 'b', 'c', 'd'), x=[2, 3]), ("{test {a b c} d}", "-x {2 3}")) ## Testing type = vsapi # vsapi type expects at least a class name and a part_id, so this # should raise a ValueError since it tries to get two elements from # an empty tuple self.assertRaises(ValueError, ttk._format_elemcreate, 'vsapi') # don't format returned values as a tcl script # minimum acceptable for vsapi self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b'), ("a b ", ())) # now with a state spec with multiple states self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b', ('a', 'b', 'c')), ("a b {a b} c", ())) # state spec and option self.assertEqual(ttk._format_elemcreate('vsapi', False, 'a', 'b', ('a', 'b'), opt='x'), ("a b a b", ("-opt", "x"))) # format returned values as a tcl script # state spec with a multivalue and an option self.assertEqual(ttk._format_elemcreate('vsapi', True, 'a', 'b', ('a', 'b', [1, 2]), opt='x'), ("{a b {a b} {1 2}}", "-opt x")) # Testing type = from # from type expects at least a type name self.assertRaises(IndexError, ttk._format_elemcreate, 'from') self.assertEqual(ttk._format_elemcreate('from', False, 'a'), ('a', ())) self.assertEqual(ttk._format_elemcreate('from', False, 'a', 'b'), ('a', ('b', ))) self.assertEqual(ttk._format_elemcreate('from', True, 'a', 'b'), ('{a}', 'b')) def test_format_layoutlist(self): def sample(indent=0, indent_size=2): return ttk._format_layoutlist( [('a', {'other': [1, 2, 3], 'children': [('b', {'children': [('c', {'children': [('d', {'nice': 'opt'})], 'something': (1, 2) })] })] })], indent=indent, indent_size=indent_size)[0] def sample_expected(indent=0, indent_size=2): spaces = lambda amount=0: ' ' * (amount + indent) return ( "%sa -other {1 2 3} -children {\n" "%sb -children {\n" "%sc -something {1 2} -children {\n" "%sd -nice opt\n" "%s}\n" "%s}\n" "%s}" % (spaces(), spaces(indent_size), spaces(2 * indent_size), spaces(3 * indent_size), spaces(2 * indent_size), spaces(indent_size), spaces())) # empty layout self.assertEqual(ttk._format_layoutlist([])[0], '') # smallest (after an empty one) acceptable layout smallest = ttk._format_layoutlist([('a', None)], indent=0) self.assertEqual(smallest, ttk._format_layoutlist([('a', '')], indent=0)) self.assertEqual(smallest[0], 'a') # testing indentation levels self.assertEqual(sample(), sample_expected()) for i in range(4): self.assertEqual(sample(i), sample_expected(i)) self.assertEqual(sample(i, i), sample_expected(i, i)) # invalid layout format, different kind of exceptions will be # raised # plain wrong format self.assertRaises(ValueError, ttk._format_layoutlist, ['bad', 'format']) self.assertRaises(TypeError, ttk._format_layoutlist, None) # _format_layoutlist always expects the second item (in every item) # to act like a dict (except when the value evalutes to False). self.assertRaises(AttributeError, ttk._format_layoutlist, [('a', 'b')]) # bad children formatting self.assertRaises(ValueError, ttk._format_layoutlist, [('name', {'children': {'a': None}})]) def test_script_from_settings(self): # empty options self.assertFalse(ttk._script_from_settings({'name': {'configure': None, 'map': None, 'element create': None}})) # empty layout self.assertEqual( ttk._script_from_settings({'name': {'layout': None}}), "ttk::style layout name {\nnull\n}") configdict = {u'αβγ': True, u'á': False} self.assertTrue( ttk._script_from_settings({'name': {'configure': configdict}})) mapdict = {u'üñíćódè': [(u'á', u'vãl')]} self.assertTrue( ttk._script_from_settings({'name': {'map': mapdict}})) # invalid image element self.assertRaises(IndexError, ttk._script_from_settings, {'name': {'element create': ['image']}}) # minimal valid image self.assertTrue(ttk._script_from_settings({'name': {'element create': ['image', 'name']}})) image = {'thing': {'element create': ['image', 'name', ('state1', 'state2', 'val')]}} self.assertEqual(ttk._script_from_settings(image), "ttk::style element create thing image {name {state1 state2} val} ") image['thing']['element create'].append({'opt': 30}) self.assertEqual(ttk._script_from_settings(image), "ttk::style element create thing image {name {state1 state2} val} " "-opt 30") image['thing']['element create'][-1]['opt'] = [MockTclObj(3), MockTclObj('2m')] self.assertEqual(ttk._script_from_settings(image), "ttk::style element create thing image {name {state1 state2} val} " "-opt {3 2m}") def test_tclobj_to_py(self): self.assertEqual( ttk._tclobj_to_py((MockStateSpec('a', 'b'), 'val')), [('a', 'b', 'val')]) self.assertEqual( ttk._tclobj_to_py([MockTclObj('1'), 2, MockTclObj('3m')]), [1, 2, '3m']) def test_list_from_statespec(self): def test_it(sspec, value, res_value, states): self.assertEqual(ttk._list_from_statespec( (sspec, value)), [states + (res_value, )]) states_even = tuple('state%d' % i for i in range(6)) statespec = MockStateSpec(*states_even) test_it(statespec, 'val', 'val', states_even) test_it(statespec, MockTclObj('val'), 'val', states_even) states_odd = tuple('state%d' % i for i in range(5)) statespec = MockStateSpec(*states_odd) test_it(statespec, 'val', 'val', states_odd) test_it(('a', 'b', 'c'), MockTclObj('val'), 'val', ('a', 'b', 'c')) def test_list_from_layouttuple(self): tk = MockTkApp() # empty layout tuple self.assertFalse(ttk._list_from_layouttuple(tk, ())) # shortest layout tuple self.assertEqual(ttk._list_from_layouttuple(tk, ('name', )), [('name', {})]) # not so interesting ltuple sample_ltuple = ('name', '-option', 'value') self.assertEqual(ttk._list_from_layouttuple(tk, sample_ltuple), [('name', {'option': 'value'})]) # empty children self.assertEqual(ttk._list_from_layouttuple(tk, ('something', '-children', ())), [('something', {'children': []})] ) # more interesting ltuple ltuple = ( 'name', '-option', 'niceone', '-children', ( ('otherone', '-children', ( ('child', )), '-otheropt', 'othervalue' ) ) ) self.assertEqual(ttk._list_from_layouttuple(tk, ltuple), [('name', {'option': 'niceone', 'children': [('otherone', {'otheropt': 'othervalue', 'children': [('child', {})] })] })] ) # bad tuples self.assertRaises(ValueError, ttk._list_from_layouttuple, tk, ('name', 'no_minus')) self.assertRaises(ValueError, ttk._list_from_layouttuple, tk, ('name', 'no_minus', 'value')) self.assertRaises(ValueError, ttk._list_from_layouttuple, tk, ('something', '-children')) # no children def test_val_or_dict(self): def func(res, opt=None, val=None): if opt is None: return res if val is None: return "test val" return (opt, val) tk = MockTkApp() tk.call = func self.assertEqual(ttk._val_or_dict(tk, {}, '-test:3'), {'test': '3'}) self.assertEqual(ttk._val_or_dict(tk, {}, ('-test', 3)), {'test': 3}) self.assertEqual(ttk._val_or_dict(tk, {'test': None}, 'x:y'), 'test val') self.assertEqual(ttk._val_or_dict(tk, {'test': 3}, 'x:y'), {'test': 3}) def test_convert_stringval(self): tests = ( (0, 0), ('09', 9), ('a', 'a'), (u'áÚ', u'áÚ'), ([], '[]'), (None, 'None') ) for orig, expected in tests: self.assertEqual(ttk._convert_stringval(orig), expected) if sys.getdefaultencoding() == 'ascii': self.assertRaises(UnicodeDecodeError, ttk._convert_stringval, 'á') class TclObjsToPyTest(unittest.TestCase): def test_unicode(self): adict = {'opt': u'välúè'} self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': u'välúè'}) adict['opt'] = MockTclObj(adict['opt']) self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': u'välúè'}) def test_multivalues(self): adict = {'opt': [1, 2, 3, 4]} self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 2, 3, 4]}) adict['opt'] = [1, 'xm', 3] self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 'xm', 3]}) adict['opt'] = (MockStateSpec('a', 'b'), u'válũè') self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [('a', 'b', u'válũè')]}) self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}), {'x': ['y z']}) def test_nosplit(self): self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}), {'text': 'some text'}) tests_nogui = (InternalFunctionsTest, TclObjsToPyTest) if __name__ == "__main__": from test.test_support import run_unittest run_unittest(*tests_nogui) PK!d67>>test_functions.pycnu[ zfc@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        PK!d67>>test_functions.pyonu[ zfc@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        PK!ܐb b test_style.pynu[import unittest import Tkinter as tkinter import ttk from test.test_support import requires, run_unittest from test_ttk.support import AbstractTkTest requires('gui') class StyleTest(AbstractTkTest, unittest.TestCase): def setUp(self): super(StyleTest, self).setUp() self.style = ttk.Style(self.root) def test_configure(self): style = self.style style.configure('TButton', background='yellow') self.assertEqual(style.configure('TButton', 'background'), 'yellow') self.assertIsInstance(style.configure('TButton'), dict) def test_map(self): style = self.style style.map('TButton', background=[('active', 'background', 'blue')]) self.assertEqual(style.map('TButton', 'background'), [('active', 'background', 'blue')] if self.wantobjects else [('active background', 'blue')]) self.assertIsInstance(style.map('TButton'), dict) def test_lookup(self): style = self.style style.configure('TButton', background='yellow') style.map('TButton', background=[('active', 'background', 'blue')]) self.assertEqual(style.lookup('TButton', 'background'), 'yellow') self.assertEqual(style.lookup('TButton', 'background', ['active', 'background']), 'blue') self.assertEqual(style.lookup('TButton', 'optionnotdefined', default='iknewit'), 'iknewit') def test_layout(self): style = self.style self.assertRaises(tkinter.TclError, style.layout, 'NotALayout') tv_style = style.layout('Treeview') # "erase" Treeview layout style.layout('Treeview', '') self.assertEqual(style.layout('Treeview'), [('null', {'sticky': 'nswe'})] ) # restore layout style.layout('Treeview', tv_style) self.assertEqual(style.layout('Treeview'), tv_style) # should return a list self.assertIsInstance(style.layout('TButton'), list) # correct layout, but "option" doesn't exist as option self.assertRaises(tkinter.TclError, style.layout, 'Treeview', [('name', {'option': 'inexistent'})]) def test_theme_use(self): self.assertRaises(tkinter.TclError, self.style.theme_use, 'nonexistingname') curr_theme = self.style.theme_use() new_theme = None for theme in self.style.theme_names(): if theme != curr_theme: new_theme = theme self.style.theme_use(theme) break else: # just one theme available, can't go on with tests return self.assertFalse(curr_theme == new_theme) self.assertFalse(new_theme != self.style.theme_use()) self.style.theme_use(curr_theme) tests_gui = (StyleTest, ) if __name__ == "__main__": run_unittest(*tests_gui) PK!M3 test_style.pycnu[ zfc@sddlZddlZddlZddlmZmZddlmZeddeej fdYZ e fZ e dkree ndS(iN(trequirest run_unittest(tAbstractTkTesttguit StyleTestcBs>eZdZdZdZdZdZdZRS(cCs,tt|jtj|j|_dS(N(tsuperRtsetUptttktStyletroottstyle(tself((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyR scCsU|j}|jddd|j|jddd|j|jdtdS(NtTButtont backgroundtyellow(R t configuret assertEqualtassertIsInstancetdict(R R ((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_configures  cCsm|j}|jdddg|j|jdd|jrFdgndg|j|jdtdS( NR R tactivetbluesactive background(RR R(RR R(sactive backgroundR(R tmapRt wantobjectsRR(R R ((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_maps   cCs|j}|jddd|jddd g|j|jddd|j|jddddgd|j|jddddddS( NR R RRRtoptionnotdefinedtdefaulttiknewit(RR R(R RRRtlookup(R R ((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyt test_lookup!s cCs|j}|jtj|jd|jd}|jdd|j|jddidd6fg|jd||j|jd||j|jdt|jtj|jddid d 6fgdS( Nt NotALayouttTreeviewttnulltnswetstickyR tnamet inexistenttoption(R t assertRaisesttkintertTclErrortlayoutRRtlist(R R ttv_style((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyt test_layout-s cCs|jtj|jjd|jj}d}xA|jjD],}||krA|}|jj|PqAqAWdS|j||k|j||jjk|jj|dS(Ntnonexistingname(R'R(R)R t theme_usetNonet theme_namest assertFalse(R t curr_themet new_themettheme((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_theme_useDs (t__name__t __module__RRRRR-R6(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyR s    t__main__( tunittesttTkinterR(Rttest.test_supportRRttest_ttk.supportRtTestCaseRt tests_guiR7(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyts    P  PK!M3 test_style.pyonu[ zfc@sddlZddlZddlZddlmZmZddlmZeddeej fdYZ e fZ e dkree ndS(iN(trequirest run_unittest(tAbstractTkTesttguit StyleTestcBs>eZdZdZdZdZdZdZRS(cCs,tt|jtj|j|_dS(N(tsuperRtsetUptttktStyletroottstyle(tself((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyR scCsU|j}|jddd|j|jddd|j|jdtdS(NtTButtont backgroundtyellow(R t configuret assertEqualtassertIsInstancetdict(R R ((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_configures  cCsm|j}|jdddg|j|jdd|jrFdgndg|j|jdtdS( NR R tactivetbluesactive background(RR R(RR R(sactive backgroundR(R tmapRt wantobjectsRR(R R ((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_maps   cCs|j}|jddd|jddd g|j|jddd|j|jddddgd|j|jddddddS( NR R RRRtoptionnotdefinedtdefaulttiknewit(RR R(R RRRtlookup(R R ((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyt test_lookup!s cCs|j}|jtj|jd|jd}|jdd|j|jddidd6fg|jd||j|jd||j|jdt|jtj|jddid d 6fgdS( Nt NotALayouttTreeviewttnulltnswetstickyR tnamet inexistenttoption(R t assertRaisesttkintertTclErrortlayoutRRtlist(R R ttv_style((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyt test_layout-s cCs|jtj|jjd|jj}d}xA|jjD],}||krA|}|jj|PqAqAWdS|j||k|j||jjk|jj|dS(Ntnonexistingname(R'R(R)R t theme_usetNonet theme_namest assertFalse(R t curr_themet new_themettheme((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyttest_theme_useDs (t__name__t __module__RRRRR-R6(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyR s    t__main__( tunittesttTkinterR(Rttest.test_supportRRttest_ttk.supportRtTestCaseRt tests_guiR7(((s7/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.pyts    P  PK!Vtest_widgets.pynu[import unittest import Tkinter as tkinter from Tkinter import TclError import ttk from test.test_support import requires, run_unittest, have_unicode, u import sys from test_functions import MockTclObj from support import (AbstractTkTest, tcl_version, get_tk_patchlevel, simulate_mouse_click) from widget_tests import (add_standard_options, noconv, noconv_meth, AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests, setUpModule) requires('gui') class StandardTtkOptionsTests(StandardOptionsTests): def test_class(self): widget = self.create() self.assertEqual(widget['class'], '') errmsg='attempt to change read-only option' if get_tk_patchlevel() < (8, 6, 0, 'beta', 3): errmsg='Attempt to change read-only option' self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg) widget2 = self.create(class_='Foo') self.assertEqual(widget2['class'], 'Foo') def test_padding(self): widget = self.create() self.checkParam(widget, 'padding', 0, expected=('0',)) self.checkParam(widget, 'padding', 5, expected=('5',)) self.checkParam(widget, 'padding', (5, 6), expected=('5', '6')) self.checkParam(widget, 'padding', (5, 6, 7), expected=('5', '6', '7')) self.checkParam(widget, 'padding', (5, 6, 7, 8), expected=('5', '6', '7', '8')) self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p')) self.checkParam(widget, 'padding', (), expected='') def test_style(self): widget = self.create() self.assertEqual(widget['style'], '') errmsg = 'Layout Foo not found' if hasattr(self, 'default_orient'): errmsg = ('Layout %s.Foo not found' % getattr(self, 'default_orient').title()) self.checkInvalidParam(widget, 'style', 'Foo', errmsg=errmsg) widget2 = self.create(class_='Foo') self.assertEqual(widget2['class'], 'Foo') # XXX pass class WidgetTest(AbstractTkTest, unittest.TestCase): """Tests methods available in every ttk widget.""" def setUp(self): super(WidgetTest, self).setUp() self.widget = ttk.Button(self.root, width=0, text="Text") self.widget.pack() self.widget.wait_visibility() def test_identify(self): self.widget.update_idletasks() self.assertEqual(self.widget.identify( self.widget.winfo_width() // 2, self.widget.winfo_height() // 2 ), "label") self.assertEqual(self.widget.identify(-1, -1), "") self.assertRaises(tkinter.TclError, self.widget.identify, None, 5) self.assertRaises(tkinter.TclError, self.widget.identify, 5, None) self.assertRaises(tkinter.TclError, self.widget.identify, 5, '') def test_widget_state(self): # XXX not sure about the portability of all these tests self.assertEqual(self.widget.state(), ()) self.assertEqual(self.widget.instate(['!disabled']), True) # changing from !disabled to disabled self.assertEqual(self.widget.state(['disabled']), ('!disabled', )) # no state change self.assertEqual(self.widget.state(['disabled']), ()) # change back to !disable but also active self.assertEqual(self.widget.state(['!disabled', 'active']), ('!active', 'disabled')) # no state changes, again self.assertEqual(self.widget.state(['!disabled', 'active']), ()) self.assertEqual(self.widget.state(['active', '!disabled']), ()) def test_cb(arg1, **kw): return arg1, kw self.assertEqual(self.widget.instate(['!disabled'], test_cb, "hi", **{"msg": "there"}), ('hi', {'msg': 'there'})) # attempt to set invalid statespec currstate = self.widget.state() self.assertRaises(tkinter.TclError, self.widget.instate, ['badstate']) self.assertRaises(tkinter.TclError, self.widget.instate, ['disabled', 'badstate']) # verify that widget didn't change its state self.assertEqual(currstate, self.widget.state()) # ensuring that passing None as state doesn't modify current state self.widget.state(['active', '!disabled']) self.assertEqual(self.widget.state(), ('active', )) class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests): _conv_pixels = noconv_meth @add_standard_options(StandardTtkOptionsTests) class FrameTest(AbstractToplevelTest, unittest.TestCase): OPTIONS = ( 'borderwidth', 'class', 'cursor', 'height', 'padding', 'relief', 'style', 'takefocus', 'width', ) def create(self, **kwargs): return ttk.Frame(self.root, **kwargs) @add_standard_options(StandardTtkOptionsTests) class LabelFrameTest(AbstractToplevelTest, unittest.TestCase): OPTIONS = ( 'borderwidth', 'class', 'cursor', 'height', 'labelanchor', 'labelwidget', 'padding', 'relief', 'style', 'takefocus', 'text', 'underline', 'width', ) def create(self, **kwargs): return ttk.LabelFrame(self.root, **kwargs) def test_labelanchor(self): widget = self.create() self.checkEnumParam(widget, 'labelanchor', 'e', 'en', 'es', 'n', 'ne', 'nw', 's', 'se', 'sw', 'w', 'wn', 'ws', errmsg='Bad label anchor specification {}') self.checkInvalidParam(widget, 'labelanchor', 'center') def test_labelwidget(self): widget = self.create() label = ttk.Label(self.root, text='Mupp', name='foo') self.checkParam(widget, 'labelwidget', label, expected='.foo') label.destroy() class AbstractLabelTest(AbstractWidgetTest): def checkImageParam(self, widget, name): image = tkinter.PhotoImage(master=self.root, name='image1') image2 = tkinter.PhotoImage(master=self.root, name='image2') self.checkParam(widget, name, image, expected=('image1',)) self.checkParam(widget, name, 'image1', expected=('image1',)) self.checkParam(widget, name, (image,), expected=('image1',)) self.checkParam(widget, name, (image, 'active', image2), expected=('image1', 'active', 'image2')) self.checkParam(widget, name, 'image1 active image2', expected=('image1', 'active', 'image2')) self.checkInvalidParam(widget, name, 'spam', errmsg='image "spam" doesn\'t exist') def test_compound(self): widget = self.create() self.checkEnumParam(widget, 'compound', 'none', 'text', 'image', 'center', 'top', 'bottom', 'left', 'right') def test_state(self): widget = self.create() self.checkParams(widget, 'state', 'active', 'disabled', 'normal') def test_width(self): widget = self.create() self.checkParams(widget, 'width', 402, -402, 0) @add_standard_options(StandardTtkOptionsTests) class LabelTest(AbstractLabelTest, unittest.TestCase): OPTIONS = ( 'anchor', 'background', 'borderwidth', 'class', 'compound', 'cursor', 'font', 'foreground', 'image', 'justify', 'padding', 'relief', 'state', 'style', 'takefocus', 'text', 'textvariable', 'underline', 'width', 'wraplength', ) _conv_pixels = noconv_meth def create(self, **kwargs): return ttk.Label(self.root, **kwargs) def test_font(self): widget = self.create() self.checkParam(widget, 'font', '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') @add_standard_options(StandardTtkOptionsTests) class ButtonTest(AbstractLabelTest, unittest.TestCase): OPTIONS = ( 'class', 'command', 'compound', 'cursor', 'default', 'image', 'padding', 'state', 'style', 'takefocus', 'text', 'textvariable', 'underline', 'width', ) def create(self, **kwargs): return ttk.Button(self.root, **kwargs) def test_default(self): widget = self.create() self.checkEnumParam(widget, 'default', 'normal', 'active', 'disabled') def test_invoke(self): success = [] btn = ttk.Button(self.root, command=lambda: success.append(1)) btn.invoke() self.assertTrue(success) @add_standard_options(StandardTtkOptionsTests) class CheckbuttonTest(AbstractLabelTest, unittest.TestCase): OPTIONS = ( 'class', 'command', 'compound', 'cursor', 'image', 'offvalue', 'onvalue', 'padding', 'state', 'style', 'takefocus', 'text', 'textvariable', 'underline', 'variable', 'width', ) def create(self, **kwargs): return ttk.Checkbutton(self.root, **kwargs) def test_offvalue(self): widget = self.create() self.checkParams(widget, 'offvalue', 1, 2.3, '', 'any string') def test_onvalue(self): widget = self.create() self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string') def test_invoke(self): success = [] def cb_test(): success.append(1) return "cb test called" cbtn = ttk.Checkbutton(self.root, command=cb_test) # the variable automatically created by ttk.Checkbutton is actually # undefined till we invoke the Checkbutton self.assertEqual(cbtn.state(), ('alternate', )) self.assertRaises(tkinter.TclError, cbtn.tk.globalgetvar, cbtn['variable']) res = cbtn.invoke() self.assertEqual(res, "cb test called") self.assertEqual(cbtn['onvalue'], cbtn.tk.globalgetvar(cbtn['variable'])) self.assertTrue(success) cbtn['command'] = '' res = cbtn.invoke() self.assertFalse(str(res)) self.assertLessEqual(len(success), 1) self.assertEqual(cbtn['offvalue'], cbtn.tk.globalgetvar(cbtn['variable'])) @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests) class EntryTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'background', 'class', 'cursor', 'exportselection', 'font', 'foreground', 'invalidcommand', 'justify', 'show', 'state', 'style', 'takefocus', 'textvariable', 'validate', 'validatecommand', 'width', 'xscrollcommand', ) def setUp(self): super(EntryTest, self).setUp() self.entry = self.create() def create(self, **kwargs): return ttk.Entry(self.root, **kwargs) def test_invalidcommand(self): widget = self.create() self.checkCommandParam(widget, 'invalidcommand') def test_show(self): widget = self.create() self.checkParam(widget, 'show', '*') self.checkParam(widget, 'show', '') self.checkParam(widget, 'show', ' ') def test_state(self): widget = self.create() self.checkParams(widget, 'state', 'disabled', 'normal', 'readonly') def test_validate(self): widget = self.create() self.checkEnumParam(widget, 'validate', 'all', 'key', 'focus', 'focusin', 'focusout', 'none') def test_validatecommand(self): widget = self.create() self.checkCommandParam(widget, 'validatecommand') def test_bbox(self): self.assertIsBoundingBox(self.entry.bbox(0)) self.assertRaises(tkinter.TclError, self.entry.bbox, 'noindex') self.assertRaises(tkinter.TclError, self.entry.bbox, None) def test_identify(self): self.entry.pack() self.entry.wait_visibility() self.entry.update_idletasks() # bpo-27313: macOS Cocoa widget differs from X, allow either if sys.platform == 'darwin': self.assertIn(self.entry.identify(5, 5), ("textarea", "Combobox.button") ) else: self.assertEqual(self.entry.identify(5, 5), "textarea") self.assertEqual(self.entry.identify(-1, -1), "") self.assertRaises(tkinter.TclError, self.entry.identify, None, 5) self.assertRaises(tkinter.TclError, self.entry.identify, 5, None) self.assertRaises(tkinter.TclError, self.entry.identify, 5, '') def test_validation_options(self): success = [] test_invalid = lambda: success.append(True) self.entry['validate'] = 'none' self.entry['validatecommand'] = lambda: False self.entry['invalidcommand'] = test_invalid self.entry.validate() self.assertTrue(success) self.entry['invalidcommand'] = '' self.entry.validate() self.assertEqual(len(success), 1) self.entry['invalidcommand'] = test_invalid self.entry['validatecommand'] = lambda: True self.entry.validate() self.assertEqual(len(success), 1) self.entry['validatecommand'] = '' self.entry.validate() self.assertEqual(len(success), 1) self.entry['validatecommand'] = True self.assertRaises(tkinter.TclError, self.entry.validate) def test_validation(self): validation = [] def validate(to_insert): if not 'a' <= to_insert.lower() <= 'z': validation.append(False) return False validation.append(True) return True self.entry['validate'] = 'key' self.entry['validatecommand'] = self.entry.register(validate), '%S' self.entry.insert('end', 1) self.entry.insert('end', 'a') self.assertEqual(validation, [False, True]) self.assertEqual(self.entry.get(), 'a') def test_revalidation(self): def validate(content): for letter in content: if not 'a' <= letter.lower() <= 'z': return False return True self.entry['validatecommand'] = self.entry.register(validate), '%P' self.entry.insert('end', 'avocado') self.assertEqual(self.entry.validate(), True) self.assertEqual(self.entry.state(), ()) self.entry.delete(0, 'end') self.assertEqual(self.entry.get(), '') self.entry.insert('end', 'a1b') self.assertEqual(self.entry.validate(), False) self.assertEqual(self.entry.state(), ('invalid', )) self.entry.delete(1) self.assertEqual(self.entry.validate(), True) self.assertEqual(self.entry.state(), ()) @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests) class ComboboxTest(EntryTest, unittest.TestCase): OPTIONS = ( 'background', 'class', 'cursor', 'exportselection', 'font', 'foreground', 'height', 'invalidcommand', 'justify', 'postcommand', 'show', 'state', 'style', 'takefocus', 'textvariable', 'validate', 'validatecommand', 'values', 'width', 'xscrollcommand', ) def setUp(self): super(ComboboxTest, self).setUp() self.combo = self.create() def create(self, **kwargs): return ttk.Combobox(self.root, **kwargs) def test_height(self): widget = self.create() self.checkParams(widget, 'height', 100, 101.2, 102.6, -100, 0, '1i') def _show_drop_down_listbox(self): width = self.combo.winfo_width() self.combo.event_generate('', x=width - 5, y=5) self.combo.event_generate('', x=width - 5, y=5) self.combo.update_idletasks() def test_virtual_event(self): success = [] self.combo['values'] = [1] self.combo.bind('<>', lambda evt: success.append(True)) self.combo.pack() self.combo.wait_visibility() height = self.combo.winfo_height() self._show_drop_down_listbox() self.combo.update() self.combo.event_generate('') self.combo.update() self.assertTrue(success) def test_postcommand(self): success = [] self.combo['postcommand'] = lambda: success.append(True) self.combo.pack() self.combo.wait_visibility() self._show_drop_down_listbox() self.assertTrue(success) # testing postcommand removal self.combo['postcommand'] = '' self._show_drop_down_listbox() self.assertEqual(len(success), 1) def test_values(self): def check_get_current(getval, currval): self.assertEqual(self.combo.get(), getval) self.assertEqual(self.combo.current(), currval) self.assertEqual(self.combo['values'], () if tcl_version < (8, 5) else '') check_get_current('', -1) self.checkParam(self.combo, 'values', 'mon tue wed thur', expected=('mon', 'tue', 'wed', 'thur')) self.checkParam(self.combo, 'values', ('mon', 'tue', 'wed', 'thur')) self.checkParam(self.combo, 'values', (42, 3.14, '', 'any string')) self.checkParam(self.combo, 'values', () if tcl_version < (8, 5) else '') self.combo['values'] = ['a', 1, 'c'] self.combo.set('c') check_get_current('c', 2) self.combo.current(0) check_get_current('a', 0) self.combo.set('d') check_get_current('d', -1) # testing values with empty string self.combo.set('') self.combo['values'] = (1, 2, '', 3) check_get_current('', 2) # testing values with empty string set through configure self.combo.configure(values=[1, '', 2]) self.assertEqual(self.combo['values'], ('1', '', '2') if self.wantobjects else '1 {} 2') # testing values with spaces self.combo['values'] = ['a b', 'a\tb', 'a\nb'] self.assertEqual(self.combo['values'], ('a b', 'a\tb', 'a\nb') if self.wantobjects else '{a b} {a\tb} {a\nb}') # testing values with special characters self.combo['values'] = [r'a\tb', '"a"', '} {'] self.assertEqual(self.combo['values'], (r'a\tb', '"a"', '} {') if self.wantobjects else r'a\\tb {"a"} \}\ \{') # out of range self.assertRaises(tkinter.TclError, self.combo.current, len(self.combo['values'])) # it expects an integer (or something that can be converted to int) self.assertRaises(tkinter.TclError, self.combo.current, '') # testing creating combobox with empty string in values combo2 = ttk.Combobox(self.root, values=[1, 2, '']) self.assertEqual(combo2['values'], ('1', '2', '') if self.wantobjects else '1 2 {}') combo2.destroy() @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests) class PanedWindowTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'cursor', 'height', 'orient', 'style', 'takefocus', 'width', ) def setUp(self): super(PanedWindowTest, self).setUp() self.paned = self.create() def create(self, **kwargs): return ttk.PanedWindow(self.root, **kwargs) def test_orient(self): widget = self.create() self.assertEqual(str(widget['orient']), 'vertical') errmsg='attempt to change read-only option' if get_tk_patchlevel() < (8, 6, 0, 'beta', 3): errmsg='Attempt to change read-only option' self.checkInvalidParam(widget, 'orient', 'horizontal', errmsg=errmsg) widget2 = self.create(orient='horizontal') self.assertEqual(str(widget2['orient']), 'horizontal') def test_add(self): # attempt to add a child that is not a direct child of the paned window label = ttk.Label(self.paned) child = ttk.Label(label) self.assertRaises(tkinter.TclError, self.paned.add, child) label.destroy() child.destroy() # another attempt label = ttk.Label(self.root) child = ttk.Label(label) self.assertRaises(tkinter.TclError, self.paned.add, child) child.destroy() label.destroy() good_child = ttk.Label(self.root) self.paned.add(good_child) # re-adding a child is not accepted self.assertRaises(tkinter.TclError, self.paned.add, good_child) other_child = ttk.Label(self.paned) self.paned.add(other_child) self.assertEqual(self.paned.pane(0), self.paned.pane(1)) self.assertRaises(tkinter.TclError, self.paned.pane, 2) good_child.destroy() other_child.destroy() self.assertRaises(tkinter.TclError, self.paned.pane, 0) def test_forget(self): self.assertRaises(tkinter.TclError, self.paned.forget, None) self.assertRaises(tkinter.TclError, self.paned.forget, 0) self.paned.add(ttk.Label(self.root)) self.paned.forget(0) self.assertRaises(tkinter.TclError, self.paned.forget, 0) def test_insert(self): self.assertRaises(tkinter.TclError, self.paned.insert, None, 0) self.assertRaises(tkinter.TclError, self.paned.insert, 0, None) self.assertRaises(tkinter.TclError, self.paned.insert, 0, 0) child = ttk.Label(self.root) child2 = ttk.Label(self.root) child3 = ttk.Label(self.root) self.assertRaises(tkinter.TclError, self.paned.insert, 0, child) self.paned.insert('end', child2) self.paned.insert(0, child) self.assertEqual(self.paned.panes(), (str(child), str(child2))) self.paned.insert(0, child2) self.assertEqual(self.paned.panes(), (str(child2), str(child))) self.paned.insert('end', child3) self.assertEqual(self.paned.panes(), (str(child2), str(child), str(child3))) # reinserting a child should move it to its current position panes = self.paned.panes() self.paned.insert('end', child3) self.assertEqual(panes, self.paned.panes()) # moving child3 to child2 position should result in child2 ending up # in previous child position and child ending up in previous child3 # position self.paned.insert(child2, child3) self.assertEqual(self.paned.panes(), (str(child3), str(child2), str(child))) def test_pane(self): self.assertRaises(tkinter.TclError, self.paned.pane, 0) child = ttk.Label(self.root) self.paned.add(child) self.assertIsInstance(self.paned.pane(0), dict) self.assertEqual(self.paned.pane(0, weight=None), 0 if self.wantobjects else '0') # newer form for querying a single option self.assertEqual(self.paned.pane(0, 'weight'), 0 if self.wantobjects else '0') self.assertEqual(self.paned.pane(0), self.paned.pane(str(child))) self.assertRaises(tkinter.TclError, self.paned.pane, 0, badoption='somevalue') def test_sashpos(self): self.assertRaises(tkinter.TclError, self.paned.sashpos, None) self.assertRaises(tkinter.TclError, self.paned.sashpos, '') self.assertRaises(tkinter.TclError, self.paned.sashpos, 0) child = ttk.Label(self.paned, text='a') self.paned.add(child, weight=1) self.assertRaises(tkinter.TclError, self.paned.sashpos, 0) child2 = ttk.Label(self.paned, text='b') self.paned.add(child2) self.assertRaises(tkinter.TclError, self.paned.sashpos, 1) self.paned.pack(expand=True, fill='both') self.paned.wait_visibility() curr_pos = self.paned.sashpos(0) self.paned.sashpos(0, 1000) self.assertNotEqual(curr_pos, self.paned.sashpos(0)) self.assertIsInstance(self.paned.sashpos(0), int) @add_standard_options(StandardTtkOptionsTests) class RadiobuttonTest(AbstractLabelTest, unittest.TestCase): OPTIONS = ( 'class', 'command', 'compound', 'cursor', 'image', 'padding', 'state', 'style', 'takefocus', 'text', 'textvariable', 'underline', 'value', 'variable', 'width', ) def create(self, **kwargs): return ttk.Radiobutton(self.root, **kwargs) def test_value(self): widget = self.create() self.checkParams(widget, 'value', 1, 2.3, '', 'any string') def test_invoke(self): success = [] def cb_test(): success.append(1) return "cb test called" myvar = tkinter.IntVar(self.root) cbtn = ttk.Radiobutton(self.root, command=cb_test, variable=myvar, value=0) cbtn2 = ttk.Radiobutton(self.root, command=cb_test, variable=myvar, value=1) if self.wantobjects: conv = lambda x: x else: conv = int res = cbtn.invoke() self.assertEqual(res, "cb test called") self.assertEqual(conv(cbtn['value']), myvar.get()) self.assertEqual(myvar.get(), conv(cbtn.tk.globalgetvar(cbtn['variable']))) self.assertTrue(success) cbtn2['command'] = '' res = cbtn2.invoke() self.assertEqual(str(res), '') self.assertLessEqual(len(success), 1) self.assertEqual(conv(cbtn2['value']), myvar.get()) self.assertEqual(myvar.get(), conv(cbtn.tk.globalgetvar(cbtn['variable']))) self.assertEqual(str(cbtn['variable']), str(cbtn2['variable'])) class MenubuttonTest(AbstractLabelTest, unittest.TestCase): OPTIONS = ( 'class', 'compound', 'cursor', 'direction', 'image', 'menu', 'padding', 'state', 'style', 'takefocus', 'text', 'textvariable', 'underline', 'width', ) def create(self, **kwargs): return ttk.Menubutton(self.root, **kwargs) def test_direction(self): widget = self.create() self.checkEnumParam(widget, 'direction', 'above', 'below', 'left', 'right', 'flush') def test_menu(self): widget = self.create() menu = tkinter.Menu(widget, name='menu') self.checkParam(widget, 'menu', menu, conv=str) menu.destroy() @add_standard_options(StandardTtkOptionsTests) class ScaleTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'command', 'cursor', 'from', 'length', 'orient', 'style', 'takefocus', 'to', 'value', 'variable', ) _conv_pixels = noconv_meth default_orient = 'horizontal' def setUp(self): super(ScaleTest, self).setUp() self.scale = self.create() self.scale.pack() self.scale.update() def create(self, **kwargs): return ttk.Scale(self.root, **kwargs) def test_from(self): widget = self.create() self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=False) def test_length(self): widget = self.create() self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i') def test_to(self): widget = self.create() self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10, conv=False) def test_value(self): widget = self.create() self.checkFloatParam(widget, 'value', 300, 14.9, 15.1, -10, conv=False) def test_custom_event(self): failure = [1, 1, 1] # will need to be empty funcid = self.scale.bind('<>', lambda evt: failure.pop()) self.scale['from'] = 10 self.scale['from_'] = 10 self.scale['to'] = 3 self.assertFalse(failure) failure = [1, 1, 1] self.scale.configure(from_=2, to=5) self.scale.configure(from_=0, to=-2) self.scale.configure(to=10) self.assertFalse(failure) def test_get(self): if self.wantobjects: conv = lambda x: x else: conv = float scale_width = self.scale.winfo_width() self.assertEqual(self.scale.get(scale_width, 0), self.scale['to']) self.assertEqual(conv(self.scale.get(0, 0)), conv(self.scale['from'])) self.assertEqual(self.scale.get(), self.scale['value']) self.scale['value'] = 30 self.assertEqual(self.scale.get(), self.scale['value']) self.assertRaises(tkinter.TclError, self.scale.get, '', 0) self.assertRaises(tkinter.TclError, self.scale.get, 0, '') def test_set(self): if self.wantobjects: conv = lambda x: x else: conv = float # set restricts the max/min values according to the current range max = conv(self.scale['to']) new_max = max + 10 self.scale.set(new_max) self.assertEqual(conv(self.scale.get()), max) min = conv(self.scale['from']) self.scale.set(min - 1) self.assertEqual(conv(self.scale.get()), min) # changing directly the variable doesn't impose this limitation tho var = tkinter.DoubleVar(self.root) self.scale['variable'] = var var.set(max + 5) self.assertEqual(conv(self.scale.get()), var.get()) self.assertEqual(conv(self.scale.get()), max + 5) del var # the same happens with the value option self.scale['value'] = max + 10 self.assertEqual(conv(self.scale.get()), max + 10) self.assertEqual(conv(self.scale.get()), conv(self.scale['value'])) # nevertheless, note that the max/min values we can get specifying # x, y coords are the ones according to the current range self.assertEqual(conv(self.scale.get(0, 0)), min) self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max) self.assertRaises(tkinter.TclError, self.scale.set, None) @add_standard_options(StandardTtkOptionsTests) class ProgressbarTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'cursor', 'orient', 'length', 'mode', 'maximum', 'phase', 'style', 'takefocus', 'value', 'variable', ) _conv_pixels = noconv_meth default_orient = 'horizontal' def create(self, **kwargs): return ttk.Progressbar(self.root, **kwargs) def test_length(self): widget = self.create() self.checkPixelsParam(widget, 'length', 100.1, 56.7, '2i') def test_maximum(self): widget = self.create() self.checkFloatParam(widget, 'maximum', 150.2, 77.7, 0, -10, conv=False) def test_mode(self): widget = self.create() self.checkEnumParam(widget, 'mode', 'determinate', 'indeterminate') def test_phase(self): # XXX pass def test_value(self): widget = self.create() self.checkFloatParam(widget, 'value', 150.2, 77.7, 0, -10, conv=False) @unittest.skipIf(sys.platform == 'darwin', 'ttk.Scrollbar is special on MacOSX') @add_standard_options(StandardTtkOptionsTests) class ScrollbarTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'command', 'cursor', 'orient', 'style', 'takefocus', ) default_orient = 'vertical' def create(self, **kwargs): return ttk.Scrollbar(self.root, **kwargs) @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests) class NotebookTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'cursor', 'height', 'padding', 'style', 'takefocus', 'width', ) def setUp(self): super(NotebookTest, self).setUp() self.nb = self.create(padding=0) self.child1 = ttk.Label(self.root) self.child2 = ttk.Label(self.root) self.nb.add(self.child1, text='a') self.nb.add(self.child2, text='b') def create(self, **kwargs): return ttk.Notebook(self.root, **kwargs) def test_tab_identifiers(self): self.nb.forget(0) self.nb.hide(self.child2) self.assertRaises(tkinter.TclError, self.nb.tab, self.child1) self.assertEqual(self.nb.index('end'), 1) self.nb.add(self.child2) self.assertEqual(self.nb.index('end'), 1) self.nb.select(self.child2) self.assertTrue(self.nb.tab('current')) self.nb.add(self.child1, text='a') self.nb.pack() self.nb.wait_visibility() if sys.platform == 'darwin': tb_idx = "@20,5" else: tb_idx = "@5,5" self.assertEqual(self.nb.tab(tb_idx), self.nb.tab('current')) for i in range(5, 100, 5): try: if self.nb.tab('@%d, 5' % i, text=None) == 'a': break except tkinter.TclError: pass else: self.fail("Tab with text 'a' not found") def test_add_and_hidden(self): self.assertRaises(tkinter.TclError, self.nb.hide, -1) self.assertRaises(tkinter.TclError, self.nb.hide, 'hi') self.assertRaises(tkinter.TclError, self.nb.hide, None) self.assertRaises(tkinter.TclError, self.nb.add, None) self.assertRaises(tkinter.TclError, self.nb.add, ttk.Label(self.root), unknown='option') tabs = self.nb.tabs() self.nb.hide(self.child1) self.nb.add(self.child1) self.assertEqual(self.nb.tabs(), tabs) child = ttk.Label(self.root) self.nb.add(child, text='c') tabs = self.nb.tabs() curr = self.nb.index('current') # verify that the tab gets readded at its previous position child2_index = self.nb.index(self.child2) self.nb.hide(self.child2) self.nb.add(self.child2) self.assertEqual(self.nb.tabs(), tabs) self.assertEqual(self.nb.index(self.child2), child2_index) self.assertEqual(str(self.child2), self.nb.tabs()[child2_index]) # but the tab next to it (not hidden) is the one selected now self.assertEqual(self.nb.index('current'), curr + 1) def test_forget(self): self.assertRaises(tkinter.TclError, self.nb.forget, -1) self.assertRaises(tkinter.TclError, self.nb.forget, 'hi') self.assertRaises(tkinter.TclError, self.nb.forget, None) tabs = self.nb.tabs() child1_index = self.nb.index(self.child1) self.nb.forget(self.child1) self.assertNotIn(str(self.child1), self.nb.tabs()) self.assertEqual(len(tabs) - 1, len(self.nb.tabs())) self.nb.add(self.child1) self.assertEqual(self.nb.index(self.child1), 1) self.assertNotEqual(child1_index, self.nb.index(self.child1)) def test_index(self): self.assertRaises(tkinter.TclError, self.nb.index, -1) self.assertRaises(tkinter.TclError, self.nb.index, None) self.assertIsInstance(self.nb.index('end'), int) self.assertEqual(self.nb.index(self.child1), 0) self.assertEqual(self.nb.index(self.child2), 1) self.assertEqual(self.nb.index('end'), 2) def test_insert(self): # moving tabs tabs = self.nb.tabs() self.nb.insert(1, tabs[0]) self.assertEqual(self.nb.tabs(), (tabs[1], tabs[0])) self.nb.insert(self.child1, self.child2) self.assertEqual(self.nb.tabs(), tabs) self.nb.insert('end', self.child1) self.assertEqual(self.nb.tabs(), (tabs[1], tabs[0])) self.nb.insert('end', 0) self.assertEqual(self.nb.tabs(), tabs) # bad moves self.assertRaises(tkinter.TclError, self.nb.insert, 2, tabs[0]) self.assertRaises(tkinter.TclError, self.nb.insert, -1, tabs[0]) # new tab child3 = ttk.Label(self.root) self.nb.insert(1, child3) self.assertEqual(self.nb.tabs(), (tabs[0], str(child3), tabs[1])) self.nb.forget(child3) self.assertEqual(self.nb.tabs(), tabs) self.nb.insert(self.child1, child3) self.assertEqual(self.nb.tabs(), (str(child3), ) + tabs) self.nb.forget(child3) self.assertRaises(tkinter.TclError, self.nb.insert, 2, child3) self.assertRaises(tkinter.TclError, self.nb.insert, -1, child3) # bad inserts self.assertRaises(tkinter.TclError, self.nb.insert, 'end', None) self.assertRaises(tkinter.TclError, self.nb.insert, None, 0) self.assertRaises(tkinter.TclError, self.nb.insert, None, None) def test_select(self): self.nb.pack() self.nb.wait_visibility() success = [] tab_changed = [] self.child1.bind('', lambda evt: success.append(True)) self.nb.bind('<>', lambda evt: tab_changed.append(True)) self.assertEqual(self.nb.select(), str(self.child1)) self.nb.select(self.child2) self.assertTrue(success) self.assertEqual(self.nb.select(), str(self.child2)) self.nb.update() self.assertTrue(tab_changed) def test_tab(self): self.assertRaises(tkinter.TclError, self.nb.tab, -1) self.assertRaises(tkinter.TclError, self.nb.tab, 'notab') self.assertRaises(tkinter.TclError, self.nb.tab, None) self.assertIsInstance(self.nb.tab(self.child1), dict) self.assertEqual(self.nb.tab(self.child1, text=None), 'a') # newer form for querying a single option self.assertEqual(self.nb.tab(self.child1, 'text'), 'a') self.nb.tab(self.child1, text='abc') self.assertEqual(self.nb.tab(self.child1, text=None), 'abc') self.assertEqual(self.nb.tab(self.child1, 'text'), 'abc') def test_tabs(self): self.assertEqual(len(self.nb.tabs()), 2) self.nb.forget(self.child1) self.nb.forget(self.child2) self.assertEqual(self.nb.tabs(), ()) def test_traversal(self): self.nb.pack() self.nb.wait_visibility() self.nb.select(0) simulate_mouse_click(self.nb, 5, 5) self.nb.focus_force() self.nb.event_generate('') self.assertEqual(self.nb.select(), str(self.child2)) self.nb.focus_force() self.nb.event_generate('') self.assertEqual(self.nb.select(), str(self.child1)) self.nb.focus_force() self.nb.event_generate('') self.assertEqual(self.nb.select(), str(self.child2)) self.nb.tab(self.child1, text='a', underline=0) self.nb.enable_traversal() self.nb.focus_force() simulate_mouse_click(self.nb, 5, 5) if sys.platform == 'darwin': self.nb.event_generate('') else: self.nb.event_generate('') self.assertEqual(self.nb.select(), str(self.child1)) @add_standard_options(StandardTtkOptionsTests) class TreeviewTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'columns', 'cursor', 'displaycolumns', 'height', 'padding', 'selectmode', 'show', 'style', 'takefocus', 'xscrollcommand', 'yscrollcommand', ) def setUp(self): super(TreeviewTest, self).setUp() self.tv = self.create(padding=0) def create(self, **kwargs): return ttk.Treeview(self.root, **kwargs) def test_columns(self): widget = self.create() self.checkParam(widget, 'columns', 'a b c', expected=('a', 'b', 'c')) self.checkParam(widget, 'columns', ('a', 'b', 'c')) self.checkParam(widget, 'columns', () if tcl_version < (8, 5) else '') def test_displaycolumns(self): widget = self.create() widget['columns'] = ('a', 'b', 'c') self.checkParam(widget, 'displaycolumns', 'b a c', expected=('b', 'a', 'c')) self.checkParam(widget, 'displaycolumns', ('b', 'a', 'c')) self.checkParam(widget, 'displaycolumns', '#all', expected=('#all',)) self.checkParam(widget, 'displaycolumns', (2, 1, 0)) self.checkInvalidParam(widget, 'displaycolumns', ('a', 'b', 'd'), errmsg='Invalid column index d') self.checkInvalidParam(widget, 'displaycolumns', (1, 2, 3), errmsg='Column index 3 out of bounds') self.checkInvalidParam(widget, 'displaycolumns', (1, -2), errmsg='Column index -2 out of bounds') def test_height(self): widget = self.create() self.checkPixelsParam(widget, 'height', 100, -100, 0, '3c', conv=False) self.checkPixelsParam(widget, 'height', 101.2, 102.6, conv=noconv) def test_selectmode(self): widget = self.create() self.checkEnumParam(widget, 'selectmode', 'none', 'browse', 'extended') def test_show(self): widget = self.create() self.checkParam(widget, 'show', 'tree headings', expected=('tree', 'headings')) self.checkParam(widget, 'show', ('tree', 'headings')) self.checkParam(widget, 'show', ('headings', 'tree')) self.checkParam(widget, 'show', 'tree', expected=('tree',)) self.checkParam(widget, 'show', 'headings', expected=('headings',)) def test_bbox(self): self.tv.pack() self.assertEqual(self.tv.bbox(''), '') self.tv.wait_visibility() self.tv.update() item_id = self.tv.insert('', 'end') children = self.tv.get_children() self.assertTrue(children) bbox = self.tv.bbox(children[0]) self.assertIsBoundingBox(bbox) # compare width in bboxes self.tv['columns'] = ['test'] self.tv.column('test', width=50) bbox_column0 = self.tv.bbox(children[0], 0) root_width = self.tv.column('#0', width=None) if not self.wantobjects: root_width = int(root_width) self.assertEqual(bbox_column0[0], bbox[0] + root_width) # verify that bbox of a closed item is the empty string child1 = self.tv.insert(item_id, 'end') self.assertEqual(self.tv.bbox(child1), '') def test_children(self): # no children yet, should get an empty tuple self.assertEqual(self.tv.get_children(), ()) item_id = self.tv.insert('', 'end') self.assertIsInstance(self.tv.get_children(), tuple) self.assertEqual(self.tv.get_children()[0], item_id) # add item_id and child3 as children of child2 child2 = self.tv.insert('', 'end') child3 = self.tv.insert('', 'end') self.tv.set_children(child2, item_id, child3) self.assertEqual(self.tv.get_children(child2), (item_id, child3)) # child3 has child2 as parent, thus trying to set child2 as a children # of child3 should result in an error self.assertRaises(tkinter.TclError, self.tv.set_children, child3, child2) # remove child2 children self.tv.set_children(child2) self.assertEqual(self.tv.get_children(child2), ()) # remove root's children self.tv.set_children('') self.assertEqual(self.tv.get_children(), ()) def test_column(self): # return a dict with all options/values self.assertIsInstance(self.tv.column('#0'), dict) # return a single value of the given option if self.wantobjects: self.assertIsInstance(self.tv.column('#0', width=None), int) # set a new value for an option self.tv.column('#0', width=10) # testing new way to get option value self.assertEqual(self.tv.column('#0', 'width'), 10 if self.wantobjects else '10') self.assertEqual(self.tv.column('#0', width=None), 10 if self.wantobjects else '10') # check read-only option self.assertRaises(tkinter.TclError, self.tv.column, '#0', id='X') self.assertRaises(tkinter.TclError, self.tv.column, 'invalid') invalid_kws = [ {'unknown_option': 'some value'}, {'stretch': 'wrong'}, {'anchor': 'wrong'}, {'width': 'wrong'}, {'minwidth': 'wrong'} ] for kw in invalid_kws: self.assertRaises(tkinter.TclError, self.tv.column, '#0', **kw) def test_delete(self): self.assertRaises(tkinter.TclError, self.tv.delete, '#0') item_id = self.tv.insert('', 'end') item2 = self.tv.insert(item_id, 'end') self.assertEqual(self.tv.get_children(), (item_id, )) self.assertEqual(self.tv.get_children(item_id), (item2, )) self.tv.delete(item_id) self.assertFalse(self.tv.get_children()) # reattach should fail self.assertRaises(tkinter.TclError, self.tv.reattach, item_id, '', 'end') # test multiple item delete item1 = self.tv.insert('', 'end') item2 = self.tv.insert('', 'end') self.assertEqual(self.tv.get_children(), (item1, item2)) self.tv.delete(item1, item2) self.assertFalse(self.tv.get_children()) def test_detach_reattach(self): item_id = self.tv.insert('', 'end') item2 = self.tv.insert(item_id, 'end') # calling detach without items is valid, although it does nothing prev = self.tv.get_children() self.tv.detach() # this should do nothing self.assertEqual(prev, self.tv.get_children()) self.assertEqual(self.tv.get_children(), (item_id, )) self.assertEqual(self.tv.get_children(item_id), (item2, )) # detach item with children self.tv.detach(item_id) self.assertFalse(self.tv.get_children()) # reattach item with children self.tv.reattach(item_id, '', 'end') self.assertEqual(self.tv.get_children(), (item_id, )) self.assertEqual(self.tv.get_children(item_id), (item2, )) # move a children to the root self.tv.move(item2, '', 'end') self.assertEqual(self.tv.get_children(), (item_id, item2)) self.assertEqual(self.tv.get_children(item_id), ()) # bad values self.assertRaises(tkinter.TclError, self.tv.reattach, 'nonexistent', '', 'end') self.assertRaises(tkinter.TclError, self.tv.detach, 'nonexistent') self.assertRaises(tkinter.TclError, self.tv.reattach, item2, 'otherparent', 'end') self.assertRaises(tkinter.TclError, self.tv.reattach, item2, '', 'invalid') # multiple detach self.tv.detach(item_id, item2) self.assertEqual(self.tv.get_children(), ()) self.assertEqual(self.tv.get_children(item_id), ()) def test_exists(self): self.assertEqual(self.tv.exists('something'), False) self.assertEqual(self.tv.exists(''), True) self.assertEqual(self.tv.exists({}), False) # the following will make a tk.call equivalent to # tk.call(treeview, "exists") which should result in an error # in the tcl interpreter since tk requires an item. self.assertRaises(tkinter.TclError, self.tv.exists, None) def test_focus(self): # nothing is focused right now self.assertEqual(self.tv.focus(), '') item1 = self.tv.insert('', 'end') self.tv.focus(item1) self.assertEqual(self.tv.focus(), item1) self.tv.delete(item1) self.assertEqual(self.tv.focus(), '') # try focusing inexistent item self.assertRaises(tkinter.TclError, self.tv.focus, 'hi') def test_heading(self): # check a dict is returned self.assertIsInstance(self.tv.heading('#0'), dict) # check a value is returned self.tv.heading('#0', text='hi') self.assertEqual(self.tv.heading('#0', 'text'), 'hi') self.assertEqual(self.tv.heading('#0', text=None), 'hi') # invalid option self.assertRaises(tkinter.TclError, self.tv.heading, '#0', background=None) # invalid value self.assertRaises(tkinter.TclError, self.tv.heading, '#0', anchor=1) def test_heading_callback(self): def simulate_heading_click(x, y): simulate_mouse_click(self.tv, x, y) self.tv.update() success = [] # no success for now self.tv.pack() self.tv.wait_visibility() self.tv.heading('#0', command=lambda: success.append(True)) self.tv.column('#0', width=100) self.tv.update() # assuming that the coords (5, 5) fall into heading #0 simulate_heading_click(5, 5) if not success: self.fail("The command associated to the treeview heading wasn't " "invoked.") success = [] commands = self.tv.master._tclCommands self.tv.heading('#0', command=str(self.tv.heading('#0', command=None))) self.assertEqual(commands, self.tv.master._tclCommands) simulate_heading_click(5, 5) if not success: self.fail("The command associated to the treeview heading wasn't " "invoked.") # XXX The following raises an error in a tcl interpreter, but not in # Python #self.tv.heading('#0', command='I dont exist') #simulate_heading_click(5, 5) def test_index(self): # item 'what' doesn't exist self.assertRaises(tkinter.TclError, self.tv.index, 'what') self.assertEqual(self.tv.index(''), 0) item1 = self.tv.insert('', 'end') item2 = self.tv.insert('', 'end') c1 = self.tv.insert(item1, 'end') c2 = self.tv.insert(item1, 'end') self.assertEqual(self.tv.index(item1), 0) self.assertEqual(self.tv.index(c1), 0) self.assertEqual(self.tv.index(c2), 1) self.assertEqual(self.tv.index(item2), 1) self.tv.move(item2, '', 0) self.assertEqual(self.tv.index(item2), 0) self.assertEqual(self.tv.index(item1), 1) # check that index still works even after its parent and siblings # have been detached self.tv.detach(item1) self.assertEqual(self.tv.index(c2), 1) self.tv.detach(c1) self.assertEqual(self.tv.index(c2), 0) # but it fails after item has been deleted self.tv.delete(item1) self.assertRaises(tkinter.TclError, self.tv.index, c2) def test_insert_item(self): # parent 'none' doesn't exist self.assertRaises(tkinter.TclError, self.tv.insert, 'none', 'end') # open values self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', open='') self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', open='please') self.assertFalse(self.tv.delete(self.tv.insert('', 'end', open=True))) self.assertFalse(self.tv.delete(self.tv.insert('', 'end', open=False))) # invalid index self.assertRaises(tkinter.TclError, self.tv.insert, '', 'middle') # trying to duplicate item id is invalid itemid = self.tv.insert('', 'end', 'first-item') self.assertEqual(itemid, 'first-item') self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', 'first-item') self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', MockTclObj('first-item')) # unicode values value = u'\xe1ba' item = self.tv.insert('', 'end', values=(value, )) self.assertEqual(self.tv.item(item, 'values'), (value,) if self.wantobjects else value) self.assertEqual(self.tv.item(item, values=None), (value,) if self.wantobjects else value) self.tv.item(item, values=self.root.splitlist(self.tv.item(item, values=None))) self.assertEqual(self.tv.item(item, values=None), (value,) if self.wantobjects else value) self.assertIsInstance(self.tv.item(item), dict) # erase item values self.tv.item(item, values='') self.assertFalse(self.tv.item(item, values=None)) # item tags item = self.tv.insert('', 'end', tags=[1, 2, value]) self.assertEqual(self.tv.item(item, tags=None), ('1', '2', value) if self.wantobjects else '1 2 %s' % value) self.tv.item(item, tags=[]) self.assertFalse(self.tv.item(item, tags=None)) self.tv.item(item, tags=(1, 2)) self.assertEqual(self.tv.item(item, tags=None), ('1', '2') if self.wantobjects else '1 2') # values with spaces item = self.tv.insert('', 'end', values=('a b c', '%s %s' % (value, value))) self.assertEqual(self.tv.item(item, values=None), ('a b c', '%s %s' % (value, value)) if self.wantobjects else '{a b c} {%s %s}' % (value, value)) # text self.assertEqual(self.tv.item( self.tv.insert('', 'end', text="Label here"), text=None), "Label here") self.assertEqual(self.tv.item( self.tv.insert('', 'end', text=value), text=None), value) # test for values which are not None itemid = self.tv.insert('', 'end', 0) self.assertEqual(itemid, '0') itemid = self.tv.insert('', 'end', 0.0) self.assertEqual(itemid, '0.0') # this is because False resolves to 0 and element with 0 iid is already present self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', False) self.assertRaises(tkinter.TclError, self.tv.insert, '', 'end', '') def test_selection(self): # item 'none' doesn't exist self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none') self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none') self.assertRaises(tkinter.TclError, self.tv.selection_remove, 'none') self.assertRaises(tkinter.TclError, self.tv.selection_toggle, 'none') item1 = self.tv.insert('', 'end') item2 = self.tv.insert('', 'end') c1 = self.tv.insert(item1, 'end') c2 = self.tv.insert(item1, 'end') c3 = self.tv.insert(item1, 'end') self.assertEqual(self.tv.selection(), ()) self.tv.selection_set((c1, item2)) self.assertEqual(self.tv.selection(), (c1, item2)) self.tv.selection_set(c2) self.assertEqual(self.tv.selection(), (c2,)) self.tv.selection_add((c1, item2)) self.assertEqual(self.tv.selection(), (c1, c2, item2)) self.tv.selection_add(item1) self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) self.tv.selection_remove((item1, c3)) self.assertEqual(self.tv.selection(), (c1, c2, item2)) self.tv.selection_remove(c2) self.assertEqual(self.tv.selection(), (c1, item2)) self.tv.selection_toggle((c1, c3)) self.assertEqual(self.tv.selection(), (c3, item2)) self.tv.selection_toggle(item2) self.assertEqual(self.tv.selection(), (c3,)) self.tv.insert('', 'end', id='with spaces') self.tv.selection_set('with spaces') self.assertEqual(self.tv.selection(), ('with spaces',)) self.tv.insert('', 'end', id='{brace') self.tv.selection_set('{brace') self.assertEqual(self.tv.selection(), ('{brace',)) if have_unicode: self.tv.insert('', 'end', id=u(r'unicode\u20ac')) self.tv.selection_set(u(r'unicode\u20ac')) self.assertEqual(self.tv.selection(), (u(r'unicode\u20ac'),)) self.tv.insert('', 'end', id='bytes\xe2\x82\xac') self.tv.selection_set('bytes\xe2\x82\xac') self.assertEqual(self.tv.selection(), (u(r'bytes\u20ac') if have_unicode else 'bytes\xe2\x82\xac',)) def test_set(self): self.tv['columns'] = ['A', 'B'] item = self.tv.insert('', 'end', values=['a', 'b']) self.assertEqual(self.tv.set(item), {'A': 'a', 'B': 'b'}) self.tv.set(item, 'B', 'a') self.assertEqual(self.tv.item(item, values=None), ('a', 'a') if self.wantobjects else 'a a') self.tv['columns'] = ['B'] self.assertEqual(self.tv.set(item), {'B': 'a'}) self.tv.set(item, 'B', 'b') self.assertEqual(self.tv.set(item, column='B'), 'b') self.assertEqual(self.tv.item(item, values=None), ('b', 'a') if self.wantobjects else 'b a') self.tv.set(item, 'B', 123) self.assertEqual(self.tv.set(item, 'B'), 123 if self.wantobjects else '123') self.assertEqual(self.tv.item(item, values=None), (123, 'a') if self.wantobjects else '123 a') self.assertEqual(self.tv.set(item), {'B': 123} if self.wantobjects else {'B': '123'}) # inexistent column self.assertRaises(tkinter.TclError, self.tv.set, item, 'A') self.assertRaises(tkinter.TclError, self.tv.set, item, 'A', 'b') # inexistent item self.assertRaises(tkinter.TclError, self.tv.set, 'notme') def test_tag_bind(self): events = [] item1 = self.tv.insert('', 'end', tags=['call']) item2 = self.tv.insert('', 'end', tags=['call']) self.tv.tag_bind('call', '', lambda evt: events.append(1)) self.tv.tag_bind('call', '', lambda evt: events.append(2)) self.tv.pack() self.tv.wait_visibility() self.tv.update() pos_y = set() found = set() for i in range(0, 100, 10): if len(found) == 2: # item1 and item2 already found break item_id = self.tv.identify_row(i) if item_id and item_id not in found: pos_y.add(i) found.add(item_id) self.assertEqual(len(pos_y), 2) # item1 and item2 y pos for y in pos_y: simulate_mouse_click(self.tv, 0, y) # by now there should be 4 things in the events list, since each # item had a bind for two events that were simulated above self.assertEqual(len(events), 4) for evt in zip(events[::2], events[1::2]): self.assertEqual(evt, (1, 2)) def test_tag_configure(self): # Just testing parameter passing for now self.assertRaises(TypeError, self.tv.tag_configure) self.assertRaises(tkinter.TclError, self.tv.tag_configure, 'test', sky='blue') self.tv.tag_configure('test', foreground='blue') self.assertEqual(str(self.tv.tag_configure('test', 'foreground')), 'blue') self.assertEqual(str(self.tv.tag_configure('test', foreground=None)), 'blue') self.assertIsInstance(self.tv.tag_configure('test'), dict) def test_tag_has(self): item1 = self.tv.insert('', 'end', text='Item 1', tags=['tag1']) item2 = self.tv.insert('', 'end', text='Item 2', tags=['tag2']) self.assertRaises(TypeError, self.tv.tag_has) self.assertRaises(TclError, self.tv.tag_has, 'tag1', 'non-existing') self.assertTrue(self.tv.tag_has('tag1', item1)) self.assertFalse(self.tv.tag_has('tag1', item2)) self.assertFalse(self.tv.tag_has('tag2', item1)) self.assertTrue(self.tv.tag_has('tag2', item2)) self.assertFalse(self.tv.tag_has('tag3', item1)) self.assertFalse(self.tv.tag_has('tag3', item2)) self.assertEqual(self.tv.tag_has('tag1'), (item1,)) self.assertEqual(self.tv.tag_has('tag2'), (item2,)) self.assertEqual(self.tv.tag_has('tag3'), ()) @add_standard_options(StandardTtkOptionsTests) class SeparatorTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'cursor', 'orient', 'style', 'takefocus', # 'state'? ) default_orient = 'horizontal' def create(self, **kwargs): return ttk.Separator(self.root, **kwargs) @add_standard_options(StandardTtkOptionsTests) class SizegripTest(AbstractWidgetTest, unittest.TestCase): OPTIONS = ( 'class', 'cursor', 'style', 'takefocus', # 'state'? ) def create(self, **kwargs): return ttk.Sizegrip(self.root, **kwargs) tests_gui = ( ButtonTest, CheckbuttonTest, ComboboxTest, EntryTest, FrameTest, LabelFrameTest, LabelTest, MenubuttonTest, NotebookTest, PanedWindowTest, ProgressbarTest, RadiobuttonTest, ScaleTest, ScrollbarTest, SeparatorTest, SizegripTest, TreeviewTest, WidgetTest, ) if __name__ == "__main__": run_unittest(*tests_gui) PK!8test_widgets.pycnu[ zfc@sUddlZddlZddlmZddlZddlmZmZmZm Z ddl Z ddl m Z ddl mZmZmZmZddlmZmZmZmZmZmZmZmZeddefd YZd eejfd YZd eefd YZeedeejfdYZeedeejfdYZ defdYZ!eede!ejfdYZ"eede!ejfdYZ#eede!ejfdYZ$eeedeejfdYZ%eeede%ejfdYZ&eeedeejfdYZ'eed e!ejfd!YZ(d"e!ejfd#YZ)eed$eejfd%YZ*eed&eejfd'YZ+ej,e j-d(kd)eed*eejfd+YZ.eeed,eejfd-YZ/eed.eejfd/YZ0eed0eejfd1YZ1eed2eejfd3YZ2e#e$e&e%ee e"e)e/e'e+e(e*e.e1e2e0efZ3e4d4krQee3ndS(5iN(tTclError(trequirest run_unittestt have_unicodetu(t MockTclObj(tAbstractTkTestt tcl_versiontget_tk_patchleveltsimulate_mouse_click(tadd_standard_optionstnoconvt noconv_methtAbstractWidgetTesttStandardOptionsTeststIntegerSizeTeststPixelSizeTestst setUpModuletguitStandardTtkOptionsTestscBs#eZdZdZdZRS(cCs|j}|j|ddd}td kr>d }n|j|dd d ||jd d }|j|dd dS(Ntclassts"attempt to change read-only optioniiitbetais"Attempt to change read-only optiontFooterrmsgtclass_(iiiRi(tcreatet assertEqualRtcheckInvalidParam(tselftwidgetRtwidget2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_classs  c Cs|j}|j|dddd|j|dddd|j|dddd|j|dddd|j|dddd|j|dd|j|dddddS(Ntpaddingitexpectedt0it5it6it7it8t5pt6pt7pt8pR(R#(R$(ii(R$R%(iii(R$R%R&(iiii(R$R%R&R'(R(R)R*R+((Rt checkParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_paddings cCs|j}|j|ddd}t|drQdt|dj}n|j|ddd||jdd}|j|d ddS( NtstyleRsLayout Foo not foundtdefault_orientsLayout %s.Foo not foundRRRR(RRthasattrtgetattrttitleR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_style+s (t__name__t __module__R R-R3(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs t WidgetTestcBs)eZdZdZdZdZRS(s,Tests methods available in every ttk widget.cCsRtt|jtj|jdddd|_|jj|jjdS(NtwidthittexttText( tsuperR6tsetUptttktButtontrootRtpacktwait_visibility(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;=s! cCs|jj|j|jj|jjd|jjdd|j|jjddd|jtj|jjdd|jtj|jjdd|jtj|jjdddS(NitlabeliRi( Rtupdate_idletasksRtidentifyt winfo_widtht winfo_heightt assertRaisesttkinterRtNone(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_identifyDs cCs|j|jjd |j|jjdgt|j|jjdgd |j|jjdgd |j|jjddgd |j|jjddgd|j|jjddgdd}|j|jjdg|didd6didd6f|jj}|jtj|jjd g|jtj|jjdd g|j||jj|jjddg|j|jjddS(Ns !disabledtdisabledtactives!activec[s ||fS(N((targ1tkw((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_cbasthittheretmsgtbadstate((s !disabled((s!activeRJ(((RK(RRtstatetinstatetTrueRFRGR(RRNt currstate((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_widget_stateQs(""   (R4R5t__doc__R;RIRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR6:s  tAbstractToplevelTestcBseZeZRS((R4R5R t _conv_pixels(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRYust FrameTestc BseZd Zd ZRS( t borderwidthRtcursortheightR!treliefR.t takefocusR7cKstj|j|S(N(R<tFrameR>(Rtkwargs((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs( R\RR]R^R!R_R.R`R7(R4R5tOPTIONSR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR[ystLabelFrameTestc Bs)eZdZd ZdZdZRS(R\RR]R^t labelanchort labelwidgetR!R_R.R`R8t underlineR7cKstj|j|S(N(R<t LabelFrameR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs]|j}|j|ddddddddd d d d d dd|j|dddS(NRetetentestntnetnwtstsetswtwtwntwsRs!Bad label anchor specification {}tcenter(RtcheckEnumParamR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelanchors   'cCsQ|j}tj|jdddd}|j|d|dd|jdS(NR8tMupptnametfooRfR"s.foo(RR<tLabelR>R,tdestroy(RRRA((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelwidgets ( R\RR]R^ReRfR!R_R.R`R8RgR7(R4R5RcRRwR}(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRds  tAbstractLabelTestcBs,eZdZdZdZdZRS(cCstjd|jdd}tjd|jdd}|j|||dd |j||ddd |j|||fdd |j|||d|fdd|j||ddd|j||dd d dS(NtmasterRytimage1timage2R"RKsimage1 active image2tspamRsimage "spam" doesn't exist(R(R(R(RRKR(RRKR(RGt PhotoImageR>R,R(RRRytimageR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheckImageParamsc Cs8|j}|j|ddddddddd dS( NtcompoundtnoneR8RRuttoptbottomtlefttright(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_compounds   cCs)|j}|j|dddddS(NRSRKRJtnormal(Rt checkParams(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_states cCs)|j}|j|dddddS(NR7iini(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_widths (R4R5RRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR~s  t LabelTestcBs&eZdZeZdZdZRS(tanchort backgroundR\RRR]tfontt foregroundRtjustifyR!R_RSR.R`R8t textvariableRgR7t wraplengthcKstj|j|S(N(R<R{R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs#|j}|j|dddS(NRs3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_fonts  (RRR\RRR]RRRRR!R_RSR.R`R8RRgR7R(R4R5RcR RZRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs t ButtonTestcBs)eZdZdZdZdZRS(RtcommandRR]tdefaultRR!RSR.R`R8RRgR7cKstj|j|S(N(R<R=R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs)|j}|j|dddddS(NRRRKRJ(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_defaults csBgtj|jdfd}|j|jdS(NRcs jdS(Ni(tappend((tsuccess(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytR(R<R=R>tinvoket assertTrue(Rtbtn((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_invokes! (RRRR]RRR!RSR.R`R8RRgR7(R4R5RcRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs  tCheckbuttonTestcBs2eZdZdZdZdZdZRS(RRRR]RtoffvaluetonvalueR!RSR.R`R8RRgtvariableR7cKstj|j|S(N(R<t CheckbuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs,|j}|j|ddddddS(NRigffffff@Rs any string(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_offvalues cCs,|j}|j|ddddddS(NRigffffff@Rs any string(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_onvalues csgfd}tj|jd|}|j|jd |jtj|jj |d|j }|j|d|j|d|jj |d|j d|d<|j }|j t ||jtd|j|d |jj |ddS( NcsjddS(Niscb test called(R((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcb_tests Rt alternateRscb test calledRRiR(R(R<RR>RRSRFRGRttkt globalgetvarRRt assertFalsetstrtassertLessEqualtlen(RRtcbtntres((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs"       (RRRR]RRRR!RSR.R`R8RRgRR7(R4R5RcRRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs   t EntryTestcBszeZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZRS(RRR]texportselectionRRtinvalidcommandRtshowRSR.R`RtvalidatetvalidatecommandR7txscrollcommandcCs&tt|j|j|_dS(N(R:RR;Rtentry(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;#scKstj|j|S(N(R<tEntryR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR'scCs |j}|j|ddS(NR(RtcheckCommandParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_invalidcommand*s cCsI|j}|j|dd|j|dd|j|dddS(NRt*Rt (RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_show.s cCs)|j}|j|dddddS(NRSRJRtreadonly(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR4s  c Cs2|j}|j|ddddddddS(NRtalltkeytfocustfocusintfocusoutR(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_validate9s  cCs |j}|j|ddS(NR(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validatecommand>s cCsU|j|jjd|jtj|jjd|jtj|jjddS(Nitnoindex(tassertIsBoundingBoxRtbboxRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_bboxCscCs|jj|jj|jjtjdkrX|j|jjdddn|j|jjddd|j|jjddd|j t j |jjdd|j t j |jjdd|j t j |jjdddS(NtdarwinittextareasCombobox.buttoniR(RsCombobox.button( RR?R@RBtsystplatformtassertInRCRRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRIIs    cs#gfd}d|jd(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRsc Cs2|j}|j|ddddddddS(NR^idgLY@gfffffY@iit1i(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_heights cCs`|jj}|jjdd|ddd|jjdd|ddd|jjdS(Nstxitys(RRDtevent_generateRB(RR7((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt_show_drop_down_listboxs  csgdg|jd<|jjdfd|jj|jj|jj}|j|jj|jjd|jj|jdS(NiRs<>cs jtS(N(RRU(tevt(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRs( RtbindR?R@RERtupdateRR(RR^((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_virtual_events      cs~gfd|jd<|jj|jj|j|jd|jd<|j|jtddS(Ncs jtS(N(RRU((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRRRi(RR?R@RRRR(R((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_postcommands      c sfd}jjdtd#kr1d$nd|ddjjdddd%jjdd&jjdd'jjdtd(krd)nddddgjd<jjd|ddjjd|ddjjd|ddjjdd*jd<|ddjjddddgjjdjrd+nddddgjd<jjdjrd,ndddd gjd<jjdjrd-nd!jt j jjt jdjt j jjdt j jddddg}j|djrd.nd"|jdS(/Ncs6jjj|jjj|dS(N(RRRtcurrent(tgetvaltcurrval(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheck_get_currentsRiiRismon tue wed thurR"tmonttuetwedtthuri*gQ @s any stringRitciitdit1t2s1 {} 2sa bsa bsa bs{a b} {a b} {a b}sa\tbs"a"s} {sa\\tb {"a"} \}\ \{s1 2 {}(ii((RRRR(RRRR(i*gQ @Rs any string(ii((iiRi(RRR(sa bsa bsa b(sa\tbs"a"s} {(RRR(RRRR,tsetRt configuret wantobjectsRFRGRRR<RR>R|(RRtcombo2((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_valuessL (     ! (RRR]RRRR^RRRRRSR.R`RRRRR7R( R4R5RcR;RRRRRR (((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs      tPanedWindowTestcBsVeZdZdZdZd Zd Zd Zd Zd Z dZ RS(RR]R^torientR.R`R7cCs&tt|j|j|_dS(N(R:R R;Rtpaned(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;&scKstj|j|S(N(R<t PanedWindowR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR*scCs|j}|jt|ddd}td krDd }n|j|dd d ||jdd }|jt|dd dS( NR tverticals"attempt to change read-only optioniiiRis"Attempt to change read-only optiont horizontalR(iiiRi(RRRRR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_orient-s  cCsztj|j}tj|}|jtj|jj||j|jtj|j}tj|}|jtj|jj||j|jtj|j}|jj||jtj|jj|tj|j}|jj||j |jj d|jj d|jtj|jj d|j|j|jtj|jj ddS(Niii( R<R{R RFRGRtaddR|R>Rtpane(RRAtchildt good_childt other_child((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add8s(    (  cCs|jtj|jjd|jtj|jjd|jjtj|j |jjd|jtj|jjddS(Ni( RFRGRR tforgetRHRR<R{R>(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_forgetTs cCs|jtj|jjdd|jtj|jjdd|jtj|jjddtj|j}tj|j}tj|j}|jtj|jjd||jjd||jjd||j |jj t |t |f|jjd||j |jj t |t |f|jjd||j |jj t |t |t |f|jj }|jjd||j ||jj |jj|||j |jj t |t |t |fdS(NiR( RFRGRR RRHR<R{R>RtpanesR(RRtchild2tchild3R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_insert]s*++"cCs |jtj|jjdtj|j}|jj||j |jjdt |j |jjddd|j rdnd|j |jjdd|j rdnd|j |jjd|jjt||jtj|jjddddS(NitweightR#t badoptiont somevalue(RFRGRR RR<R{R>RtassertIsInstancetdictRRHRR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_panes.cCsi|jtj|jjd|jtj|jjd|jtj|jjdtj|jdd}|jj|dd|jtj|jjdtj|jdd}|jj||jtj|jjd|jj dt d d |jj |jjd}|jjdd |j ||jjd|j |jjdtdS( NRiR8RRitbtexpandtfilltbothi(RFRGRR tsashposRHR<R{RR?RUR@tassertNotEqualR tint(RRRtcurr_pos((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_sashposs (RR]R^R R.R`R7( R4R5RcR;RRRRRR"R+(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR s    # tRadiobuttonTestcBs)eZdZdZdZdZRS(RRRR]RR!RSR.R`R8RRgtvalueRR7cKstj|j|S(N(R<t RadiobuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs,|j}|j|ddddddS(NR-igffffff@Rs any string(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_values csgfd}tj|j}tj|jd|d|dd}tj|jd|d|dd}|jrd}nt}|j}|j|d|j||d|j |j|j ||j j |d|j d |d<|j}|jt |d |jtd|j||d|j |j|j ||j j |d|jt |dt |ddS( NcsjddS(Niscb test called(R((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs RRR-iicSs|S(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRscb test calledR(RGtIntVarR>R<R.RR)RRRRRRRRR(RRtmyvarRtcbtn2tconvR((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs0        (RRRR]RR!RSR.R`R8RRgR-RR7(R4R5RcRR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR,s  tMenubuttonTestcBs)eZdZdZdZdZRS(RRR]t directionRtmenuR!RSR.R`R8RRgR7cKstj|j|S(N(R<t MenubuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs/|j}|j|dddddddS(NR5tabovetbelowRRtflush(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_directions  cCsH|j}tj|dd}|j|d|dt|jdS(NRyR6R3(RRGtMenuR,RR|(RRR6((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_menus (RRR]R5RR6R!RSR.R`R8RRgR7(R4R5RcRR;R=(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR4s  t ScaleTestc BskeZdZeZd Zd Zd ZdZdZ dZ dZ dZ dZ dZRS(RRR]tfromtlengthR R.R`ttoR-RRcCs@tt|j|j|_|jj|jjdS(N(R:R>R;RtscaleR?R(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;s cKstj|j|S(N(R<tScaleR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs/|j}|j|dddddtdS(NR?idg-@g333333.@R3(RtcheckFloatParamR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_froms cCs,|j}|j|ddddddS(NR@igffffff`@g33333`@t5i(RtcheckPixelsParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_lengths c Cs2|j}|j|ddddddtdS(NRAi,g-@g333333.@iR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_to s c Cs2|j}|j|ddddddtdS(NR-i,g-@g333333.@iR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/s csdddg|jjdfd}d|jd>cs jS(N(tpop(R(tfailure(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRi R?tfrom_iRAiiii(RBRRR(Rtfuncid((RKs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_custom_events    cCs|jrd}nt}|jj}|j|jj|d|jd|j||jjdd||jd|j|jj|jdd|jd<|j|jj|jd|jtj|jjdd|jtj|jjdddS(NcSs|S(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR(RiRAR?R-iR( RtfloatRBRDRRRFRGR(RR3t scale_width((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_get&s  &2   cCs|jrd}nt}||jd}|d}|jj||j||jj|||jd}|jj|d|j||jj|tj|j}||jd<|j|d|j||jj|j|j||jj|d~|d|jd<|j||jj|d|j||jj||jd|j||jjd d ||j||jj|jj d ||j tj |jjddS( NcSs|S(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR:RRAi R?iRiR-i( RRORBRRRRGt DoubleVarR>RDRFRRH(RR3tmaxtnew_maxtmintvar((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_set8s,    %##,%.( RRR]R?R@R R.R`RAR-R(R4R5RcR RZR/R;RRERHRIR/RNRQRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR>s        tProgressbarTestc BsPeZdZeZd Zd Zd ZdZdZ dZ dZ RS(RR]R R@tmodetmaximumtphaseR.R`R-RRcKstj|j|S(N(R<t ProgressbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRfscCs)|j}|j|dddddS(NR@gfffffY@gYL@t2i(RRG(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRHis c Cs2|j}|j|ddddddtdS(NRZgfffffb@glS@iiR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_maximumms cCs&|j}|j|ddddS(NRYt determinatet indeterminate(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_modeqs cCsdS(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_phaseusc Cs2|j}|j|ddddddtdS(NR-gfffffb@glS@iiR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/ys ( RR]R R@RYRZR[R.R`R-R( R4R5RcR RZR/RRHR^RaRbR/(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRX\s     Rs"ttk.Scrollbar is special on MacOSXt ScrollbarTestcBseZdZdZdZRS( RRR]R R.R`RcKstj|j|S(N(R<t ScrollbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs(RRR]R R.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRcst NotebookTestcBsqeZdZdZdZd Zd Zd Zd Zd Z dZ dZ dZ dZ RS(RR]R^R!R.R`R7cCstt|j|jdd|_tj|j|_tj|j|_ |jj |jdd|jj |j dddS(NR!iR8RR#( R:ReR;RtnbR<R{R>tchild1RR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;s cKstj|j|S(N(R<tNotebookR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs|jjd|jj|j|jtj|jj|j|j |jj dd|jj |j|j |jj dd|jj |j|j |jjd|jj |jdd|jj|jjtjdkrd}nd }|j |jj||jjdxhtd d d D]G}y*|jjd |dddkrtPnWqEtjk rqEXqEW|jd dS(NiRiRR8RRs@20,5s@5,5iids@%d, 5sTab with text 'a' not found(RfRthideRRFRGRttabRgRtindexRtselectRR?R@RRtrangeRHtfail(Rttb_idxti((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab_identifierss,   ("cCs|jtj|jjd|jtj|jjd|jtj|jjd|jtj|jjd|jtj|jjtj|j dd|jj }|jj|j |jj|j |j |jj |tj|j }|jj|dd|jj }|jj d}|jj |j}|jj|j|jj|j|j |jj ||j |jj |j||j t|j|jj ||j |jj d|ddS( NiROtunknowntoptionR8RRi(RFRGRRfRiRHRR<R{R>ttabsRgRRkRR(RRtRtcurrt child2_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add_and_hiddens*'&cCs+|jtj|jjd|jtj|jjd|jtj|jjd|jj}|jj|j}|jj|j|j t |j|jj|j t |dt |jj|jj |j|j |jj|jd|j||jj|jdS(NiROi(RFRGRRfRRHRtRkRgt assertNotInRRRRR((RRtt child1_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs")cCs|jtj|jjd|jtj|jjd|j|jjdt|j|jj|j d|j|jj|j d|j|jjdddS(NiRiii( RFRGRRfRkRHR R)RRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_indexs cCs|jj}|jjd|d|j|jj|d|df|jj|j|j|j|jj||jjd|j|j|jj|d|df|jjdd|j|jj||jtj|jjd|d|jtj|jjd|dt j |j }|jjd||j|jj|dt ||df|jj ||j|jj||jj|j||j|jjt |f||jj ||jtj|jjd||jtj|jjd||jtj|jjdd|jtj|jjdd|jtj|jjdddS(NiiRii(RfRtRRRgRRFRGRR<R{R>RRRH(RRtR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs0''##0&cs|jj|jjgg|jjdfd|jjdfd|j|jjt|j|jj|j|j |j|jjt|j|jj |j dS(Nscs jtS(N(RRU(R(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRs<>cs jtS(N(RRU(R(t tab_changed(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRR( RfR?R@RgRRRlRRRR(R((RR{s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_selects   " " cCs|jtj|jjd|jtj|jjd|jtj|jjd|j|jj|jt|j |jj|jddd|j |jj|jdd|jj|jdd|j |jj|jddd|j |jj|jdddS(NitnotabR8Rtabc( RFRGRRfRjRHR RgR!R(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab(s%"%cCsb|jt|jjd|jj|j|jj|j|j|jjddS(Ni((RRRfRtRRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_tabs6scCs|jj|jj|jjdt|jdd|jj|jjd|j|jjt|j |jj|jjd|j|jjt|j |jj|jjd|j|jjt|j |jj |j dddd|jj |jjt|jddt jdkrh|jjd n|jjd |j|jjt|j dS( Niis sR8RRgRs s(RfR?R@RlR t focus_forceRRRRRgRjtenable_traversalRR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_traversal?s*   " " "  (RR]R^R!R.R`R7(R4R5RcR;RRqRwRRzRR|RRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRes      !   t TreeviewTestc BseZd#Zd Zd ZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZd Zd!Zd"ZRS($RtcolumnsR]tdisplaycolumnsR^R!t selectmodeRR.R`RtyscrollcommandcCs,tt|j|jdd|_dS(NR!i(R:RR;Rttv(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;cscKstj|j|S(N(R<tTreeviewR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRgscCsa|j}|j|dddd |j|dd |j|dtd krVd nd dS(NRsa b cR"RR#RiiR(RR#R(RR#R(ii((RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_columnsjs  cCs|j}d|d<|j|dddd|j|dd|j|dddd|j|dd|j|ddd d|j|ddd d|j|ddd ddS(NRR#RRRsb a cR"s#alliiiRRsInvalid column index disColumn index 3 out of boundsisColumn index -2 out of bounds(RR#R(R#RR(R#RR(s#all(iii(RR#R(iii(ii(RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_displaycolumnsqs  c CsN|j}|j|ddddddt|j|ddddtdS( NR^idiit3cR3gLY@gfffffY@(RRGRR (RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs "cCs)|j}|j|dddddS(NRRtbrowsetextended(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selectmodes  cCs|j}|j|dddd|j|dd|j|dd|j|dddd |j|dddd dS( NRs tree headingsR"ttreetheadings(RR(RR(RR(R(R(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs cCsW|jj|j|jjdd|jj|jj|jjdd}|jj}|j||jj|d}|j |dg|jd<|jj ddd|jj|dd}|jj ddd}|j st |}n|j|d|d||jj|d}|j|jj|ddS( NRRittestRR7i2s#0(RR?RRR@RRt get_childrenRRtcolumnRHRR)(Rtitem_idtchildrenRt bbox_column0t root_widthRg((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs$      cCs>|j|jjd|jjdd}|j|jjt|j|jjd||jjdd}|jjdd}|jj||||j|jj|||f|jtj |jj|||jj||j|jj|d|jjd|j|jjddS(NRRi(((( RRRRR ttuplet set_childrenRFRGR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_childrens" cCsi|j|jjdt|jrJ|j|jjdddtn|jjddd|j|jjdd|jrdnd|j|jjddd|jrdnd|jt j |jjddd|jt j |jjdidd 6id d 6id d 6id d6id d 6g}x-|D]%}|jt j |jjd|q<WdS(Ns#0R7i t10tidtXRs some valuetunknown_optiontwrongtstretchRtminwidth( R RRR!RRHR)RRFRGR(Rt invalid_kwsRM((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_columns %"$ cCs?|jtj|jjd|jjdd}|jj|d}|j|jj|f|j|jj||f|jj||j|jj|jtj|jj |dd|jjdd}|jjdd}|j|jj||f|jj|||j|jjdS(Ns#0RR( RFRGRRRRRRRtreattach(RRtitem2titem1((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_deletes cCs0|jjdd}|jj|d}|jj}|jj|j||jj|j|jj|f|j|jj||f|jj||j|jj|jj|dd|j|jj|f|j|jj||f|jj|dd|j|jj||f|j|jj|d|jt j |jjddd|jt j |jjd|jt j |jj|dd|jt j |jj|dd|jj|||j|jjd|j|jj|ddS( NRRt nonexistentt otherparentR(((( RRRtdetachRRRtmoveRFRGR(RRRtprev((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_detach_reattachs4     cCst|j|jjdt|j|jjdt|j|jjit|jtj|jjddS(Nt somethingR( RRtexistsRRURFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_exists'scCs|j|jjd|jjdd}|jj||j|jj||jj||j|jjd|jtj|jjddS(NRRRO(RRRRRRFRGR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_focus2scCs|j|jjdt|jjddd|j|jjddd|j|jjdddd|jtj|jjddd|jtj|jjddddS(Ns#0R8RORRi( R RtheadingR!RRHRFRGR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_headingAs"csfd}gjjjjjjddfdjjdddjj|ddsjdngjjj}jjddt jjdddj |jjj|ddsjdndS( Ncs$tj||jjdS(N(R RR(RR(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytsimulate_heading_clickRss#0Rcs jtS(N(RRU((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRZRR7idis>The command associated to the treeview heading wasn't invoked.( RR?R@RRRRnRt _tclCommandsRRHR(RRtcommands((RRs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_heading_callbackQs"    . cCs|jtj|jjd|j|jjdd|jjdd}|jjdd}|jj|d}|jj|d}|j|jj|d|j|jj|d|j|jj|d|j|jj|d|jj|dd|j|jj|d|j|jj|d|jj||j|jj|d|jj||j|jj|d|jj ||jtj|jj|dS(NtwhatRiRi( RFRGRRRkRRRRR(RRRtc1tc2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRzss&cCs|jtj|jjdd|jtj|jjdddd|jtj|jjdddd|j|jj|jjdddt|j|jj|jjdddt|jtj|jjdd|jjddd}|j |d|jtj|jjddd|jtj|jjddt dd}|jjddd |f}|j |jj |d |j r|fn||j |jj |d d|j r|fn||jj |d |jj|jj |d d|j |jj |d d|j r@|fn||j|jj |t|jj |d d|j|jj |d d|jjddd d d |g}|j |jj |d d|j rd d|fnd||jj |d g|j|jj |d d|jj |d d|j |jj |d d|j rodnd|jjddd dd||ff}|j |jj |d d|j rdd||ffn d||f|j |jj |jjddddddd|j |jj |jjddd|dd||jjddd}|j |d|jjddd}|j |d|jtj|jjddt|jtj|jjddddS(NRRRtopentpleasetmiddles first-itemuábaRttagsiiRRs1 2 %ss1 2sa b cs%s %ss{a b c} {%s %s}R8s Label hereiR#gs0.0(ii(RR(RFRGRRRRRRURRRtitemRRHR>t splitlistR R!(RtitemidR-R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_insert_itemsh.. 4$ !!"cCs|jtj|jjd|jtj|jjd|jtj|jjd|jtj|jjd|jjdd}|jjdd}|jj|d}|jj|d}|jj|d}|j |jj d |jj||f|j |jj ||f|jj||j |jj |f|jj||f|j |jj |||f|jj||j |jj ||||f|jj||f|j |jj |||f|jj||j |jj ||f|jj||f|j |jj ||f|jj||j |jj |f|jjdddd|jjd|j |jj d |jjdddd|jjd|j |jj d t rl|jjdddt d|jjt d|j |jj t dfn|jjdddd|jjd|j |jj t rt d ndfdS( NRRRRs with spacess{braces unicode\u20acsbytes€s bytes\u20ac((s with spaces(s{brace( RFRGRRt selection_sett selection_addtselection_removetselection_toggleRRt selectionRR(RRRRRtc3((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selectionsR"%"%cCsPddg|jd<|jjdddddg}|j|jj|idd6dd6|jj|dd|j|jj|dd|jrdnd dg|jd<|j|jj|idd6|jj|dd|j|jj|d dd|j|jj|dd|jr:dnd |jj|dd |j|jj|d|jr~d nd |j|jj|dd|jrdnd|j|jj||jrid d6n id d6|jtj |jj|d|jtj |jj|dd|jtj |jjddS(NtAtBRRRRRR#sa aRsb ai{t123s123 atnotme(RR(R#R(i{R( RRRRRRHRRFRGR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRWs,!*#"$"c sg|jjddddg}|jjddddg}|jjddfd|jjddfd|jj|jj|jjt}t}xqtd d d D]]}t|d krPn|jj |}|r||kr|j ||j |qqW|j t|d x!|D]}t |jd |qJW|j td xAt ddd ddd D]}|j |dqWdS(NRRRtcallscs jdS(Ni(R(R(tevents(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;Rscs jdS(Ni(R(R(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR=Riidi iii(ii(RRttag_bindR?R@RRRmRt identify_rowRRR tzip( RRRtpos_ytfoundRpRRR((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_tag_bind6s2       0cCs|jt|jj|jtj|jjddd|jjddd|jt|jjddd|jt|jjdddd|j |jjdt dS(NRtskytblueR( RFt TypeErrorRt tag_configureRGRRRRHR R!(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tag_configureXs !cCs|jjddddddg}|jjddddddg}|jt|jj|jt|jjdd |j|jjd||j|jjd||j|jjd||j|jjd||j|jjd ||j|jjd ||j|jjd|f|j|jjd|f|j|jjd d dS( NRRR8sItem 1Rttag1sItem 2ttag2s non-existingttag3(( RRRFRttag_hasRRRR(RRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_tag_hasds$$( RRR]RR^R!RRR.R`RR(R4R5RcR;RRRRRRRRRRRRRRRRzRRRWRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR[s4           *   "  M 6 ! " t SeparatorTestcBseZdZdZdZRS(RR]R R.R`RcKstj|j|S(N(R<t SeparatorR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR|s(RR]R R.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRtst SizegripTestcBseZdZdZRS(RR]R.R`cKstj|j|S(N(R<tSizegripR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs(RR]R.R`(R4R5RcR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRst__main__(5tunittesttTkinterRGRR<ttest.test_supportRRRRRttest_functionsRtsupportRRRR t widget_testsR R R R RRRRRtTestCaseR6RYR[RdR~RRRRRR R,R4R>RXtskipIfRRcReRRRt tests_guiR4(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytsr   " ": ';     0| 3 j "          PK!8test_widgets.pyonu[ zfc@sUddlZddlZddlmZddlZddlmZmZmZm Z ddl Z ddl m Z ddl mZmZmZmZddlmZmZmZmZmZmZmZmZeddefd YZd eejfd YZd eefd YZeedeejfdYZeedeejfdYZ defdYZ!eede!ejfdYZ"eede!ejfdYZ#eede!ejfdYZ$eeedeejfdYZ%eeede%ejfdYZ&eeedeejfdYZ'eed e!ejfd!YZ(d"e!ejfd#YZ)eed$eejfd%YZ*eed&eejfd'YZ+ej,e j-d(kd)eed*eejfd+YZ.eeed,eejfd-YZ/eed.eejfd/YZ0eed0eejfd1YZ1eed2eejfd3YZ2e#e$e&e%ee e"e)e/e'e+e(e*e.e1e2e0efZ3e4d4krQee3ndS(5iN(tTclError(trequirest run_unittestt have_unicodetu(t MockTclObj(tAbstractTkTestt tcl_versiontget_tk_patchleveltsimulate_mouse_click(tadd_standard_optionstnoconvt noconv_methtAbstractWidgetTesttStandardOptionsTeststIntegerSizeTeststPixelSizeTestst setUpModuletguitStandardTtkOptionsTestscBs#eZdZdZdZRS(cCs|j}|j|ddd}td kr>d }n|j|dd d ||jd d }|j|dd dS(Ntclassts"attempt to change read-only optioniiitbetais"Attempt to change read-only optiontFooterrmsgtclass_(iiiRi(tcreatet assertEqualRtcheckInvalidParam(tselftwidgetRtwidget2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_classs  c Cs|j}|j|dddd|j|dddd|j|dddd|j|dddd|j|dddd|j|dd|j|dddddS(Ntpaddingitexpectedt0it5it6it7it8t5pt6pt7pt8pR(R#(R$(ii(R$R%(iii(R$R%R&(iiii(R$R%R&R'(R(R)R*R+((Rt checkParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_paddings cCs|j}|j|ddd}t|drQdt|dj}n|j|ddd||jdd}|j|d ddS( NtstyleRsLayout Foo not foundtdefault_orientsLayout %s.Foo not foundRRRR(RRthasattrtgetattrttitleR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_style+s (t__name__t __module__R R-R3(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs t WidgetTestcBs)eZdZdZdZdZRS(s,Tests methods available in every ttk widget.cCsRtt|jtj|jdddd|_|jj|jjdS(NtwidthittexttText( tsuperR6tsetUptttktButtontrootRtpacktwait_visibility(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;=s! cCs|jj|j|jj|jjd|jjdd|j|jjddd|jtj|jjdd|jtj|jjdd|jtj|jjdddS(NitlabeliRi( Rtupdate_idletasksRtidentifyt winfo_widtht winfo_heightt assertRaisesttkinterRtNone(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_identifyDs cCs|j|jjd |j|jjdgt|j|jjdgd |j|jjdgd |j|jjddgd |j|jjddgd|j|jjddgdd}|j|jjdg|didd6didd6f|jj}|jtj|jjd g|jtj|jjdd g|j||jj|jjddg|j|jjddS(Ns !disabledtdisabledtactives!activec[s ||fS(N((targ1tkw((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_cbasthittheretmsgtbadstate((s !disabled((s!activeRJ(((RK(RRtstatetinstatetTrueRFRGR(RRNt currstate((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_widget_stateQs(""   (R4R5t__doc__R;RIRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR6:s  tAbstractToplevelTestcBseZeZRS((R4R5R t _conv_pixels(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRYust FrameTestc BseZd Zd ZRS( t borderwidthRtcursortheightR!treliefR.t takefocusR7cKstj|j|S(N(R<tFrameR>(Rtkwargs((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs( R\RR]R^R!R_R.R`R7(R4R5tOPTIONSR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR[ystLabelFrameTestc Bs)eZdZd ZdZdZRS(R\RR]R^t labelanchort labelwidgetR!R_R.R`R8t underlineR7cKstj|j|S(N(R<t LabelFrameR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs]|j}|j|ddddddddd d d d d dd|j|dddS(NRetetentestntnetnwtstsetswtwtwntwsRs!Bad label anchor specification {}tcenter(RtcheckEnumParamR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelanchors   'cCsQ|j}tj|jdddd}|j|d|dd|jdS(NR8tMupptnametfooRfR"s.foo(RR<tLabelR>R,tdestroy(RRRA((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_labelwidgets ( R\RR]R^ReRfR!R_R.R`R8RgR7(R4R5RcRRwR}(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRds  tAbstractLabelTestcBs,eZdZdZdZdZRS(cCstjd|jdd}tjd|jdd}|j|||dd |j||ddd |j|||fdd |j|||d|fdd|j||ddd|j||dd d dS(NtmasterRytimage1timage2R"RKsimage1 active image2tspamRsimage "spam" doesn't exist(R(R(R(RRKR(RRKR(RGt PhotoImageR>R,R(RRRytimageR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheckImageParamsc Cs8|j}|j|ddddddddd dS( NtcompoundtnoneR8RRuttoptbottomtlefttright(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_compounds   cCs)|j}|j|dddddS(NRSRKRJtnormal(Rt checkParams(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_states cCs)|j}|j|dddddS(NR7iini(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_widths (R4R5RRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR~s  t LabelTestcBs&eZdZeZdZdZRS(tanchort backgroundR\RRR]tfontt foregroundRtjustifyR!R_RSR.R`R8t textvariableRgR7t wraplengthcKstj|j|S(N(R<R{R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs#|j}|j|dddS(NRs3-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_fonts  (RRR\RRR]RRRRR!R_RSR.R`R8RRgR7R(R4R5RcR RZRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs t ButtonTestcBs)eZdZdZdZdZRS(RtcommandRR]tdefaultRR!RSR.R`R8RRgR7cKstj|j|S(N(R<R=R>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs)|j}|j|dddddS(NRRRKRJ(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_defaults csBgtj|jdfd}|j|jdS(NRcs jdS(Ni(tappend((tsuccess(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytR(R<R=R>tinvoket assertTrue(Rtbtn((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_invokes! (RRRR]RRR!RSR.R`R8RRgR7(R4R5RcRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs  tCheckbuttonTestcBs2eZdZdZdZdZdZRS(RRRR]RtoffvaluetonvalueR!RSR.R`R8RRgtvariableR7cKstj|j|S(N(R<t CheckbuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs,|j}|j|ddddddS(NRigffffff@Rs any string(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_offvalues cCs,|j}|j|ddddddS(NRigffffff@Rs any string(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_onvalues csgfd}tj|jd|}|j|jd |jtj|jj |d|j }|j|d|j|d|jj |d|j d|d<|j }|j t ||jtd|j|d |jj |ddS( NcsjddS(Niscb test called(R((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcb_tests Rt alternateRscb test calledRRiR(R(R<RR>RRSRFRGRttkt globalgetvarRRt assertFalsetstrtassertLessEqualtlen(RRtcbtntres((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs"       (RRRR]RRRR!RSR.R`R8RRgRR7(R4R5RcRRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs   t EntryTestcBszeZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZRS(RRR]texportselectionRRtinvalidcommandRtshowRSR.R`RtvalidatetvalidatecommandR7txscrollcommandcCs&tt|j|j|_dS(N(R:RR;Rtentry(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;#scKstj|j|S(N(R<tEntryR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR'scCs |j}|j|ddS(NR(RtcheckCommandParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_invalidcommand*s cCsI|j}|j|dd|j|dd|j|dddS(NRt*Rt (RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_show.s cCs)|j}|j|dddddS(NRSRJRtreadonly(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR4s  c Cs2|j}|j|ddddddddS(NRtalltkeytfocustfocusintfocusoutR(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_validate9s  cCs |j}|j|ddS(NR(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_validatecommand>s cCsU|j|jjd|jtj|jjd|jtj|jjddS(Nitnoindex(tassertIsBoundingBoxRtbboxRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_bboxCscCs|jj|jj|jjtjdkrX|j|jjdddn|j|jjddd|j|jjddd|j t j |jjdd|j t j |jjdd|j t j |jjdddS(NtdarwinittextareasCombobox.buttoniR(RsCombobox.button( RR?R@RBtsystplatformtassertInRCRRFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRIIs    cs#gfd}d|jd(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRsc Cs2|j}|j|ddddddddS(NR^idgLY@gfffffY@iit1i(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_heights cCs`|jj}|jjdd|ddd|jjdd|ddd|jjdS(Nstxitys(RRDtevent_generateRB(RR7((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt_show_drop_down_listboxs  csgdg|jd<|jjdfd|jj|jj|jj}|j|jj|jjd|jj|jdS(NiRs<>cs jtS(N(RRU(tevt(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRs( RtbindR?R@RERtupdateRR(RR^((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_virtual_events      cs~gfd|jd<|jj|jj|j|jd|jd<|j|jtddS(Ncs jtS(N(RRU((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRRRi(RR?R@RRRR(R((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_postcommands      c sfd}jjdtd#kr1d$nd|ddjjdddd%jjdd&jjdd'jjdtd(krd)nddddgjd<jjd|ddjjd|ddjjd|ddjjdd*jd<|ddjjddddgjjdjrd+nddddgjd<jjdjrd,ndddd gjd<jjdjrd-nd!jt j jjt jdjt j jjdt j jddddg}j|djrd.nd"|jdS(/Ncs6jjj|jjj|dS(N(RRRtcurrent(tgetvaltcurrval(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytcheck_get_currentsRiiRismon tue wed thurR"tmonttuetwedtthuri*gQ @s any stringRitciitdit1t2s1 {} 2sa bsa bsa bs{a b} {a b} {a b}sa\tbs"a"s} {sa\\tb {"a"} \}\ \{s1 2 {}(ii((RRRR(RRRR(i*gQ @Rs any string(ii((iiRi(RRR(sa bsa bsa b(sa\tbs"a"s} {(RRR(RRRR,tsetRt configuret wantobjectsRFRGRRR<RR>R|(RRtcombo2((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_valuessL (     ! (RRR]RRRR^RRRRRSR.R`RRRRR7R( R4R5RcR;RRRRRR (((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs      tPanedWindowTestcBsVeZdZdZdZd Zd Zd Zd Zd Z dZ RS(RR]R^torientR.R`R7cCs&tt|j|j|_dS(N(R:R R;Rtpaned(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;&scKstj|j|S(N(R<t PanedWindowR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR*scCs|j}|jt|ddd}td krDd }n|j|dd d ||jdd }|jt|dd dS( NR tverticals"attempt to change read-only optioniiiRis"Attempt to change read-only optiont horizontalR(iiiRi(RRRRR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_orient-s  cCsztj|j}tj|}|jtj|jj||j|jtj|j}tj|}|jtj|jj||j|jtj|j}|jj||jtj|jj|tj|j}|jj||j |jj d|jj d|jtj|jj d|j|j|jtj|jj ddS(Niii( R<R{R RFRGRtaddR|R>Rtpane(RRAtchildt good_childt other_child((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add8s(    (  cCs|jtj|jjd|jtj|jjd|jjtj|j |jjd|jtj|jjddS(Ni( RFRGRR tforgetRHRR<R{R>(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_forgetTs cCs|jtj|jjdd|jtj|jjdd|jtj|jjddtj|j}tj|j}tj|j}|jtj|jjd||jjd||jjd||j |jj t |t |f|jjd||j |jj t |t |f|jjd||j |jj t |t |t |f|jj }|jjd||j ||jj |jj|||j |jj t |t |t |fdS(NiR( RFRGRR RRHR<R{R>RtpanesR(RRtchild2tchild3R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_insert]s*++"cCs |jtj|jjdtj|j}|jj||j |jjdt |j |jjddd|j rdnd|j |jjdd|j rdnd|j |jjd|jjt||jtj|jjddddS(NitweightR#t badoptiont somevalue(RFRGRR RR<R{R>RtassertIsInstancetdictRRHRR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_panes.cCsi|jtj|jjd|jtj|jjd|jtj|jjdtj|jdd}|jj|dd|jtj|jjdtj|jdd}|jj||jtj|jjd|jj dt d d |jj |jjd}|jjdd |j ||jjd|j |jjdtdS( NRiR8RRitbtexpandtfilltbothi(RFRGRR tsashposRHR<R{RR?RUR@tassertNotEqualR tint(RRRtcurr_pos((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_sashposs (RR]R^R R.R`R7( R4R5RcR;RRRRRR"R+(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR s    # tRadiobuttonTestcBs)eZdZdZdZdZRS(RRRR]RR!RSR.R`R8RRgtvalueRR7cKstj|j|S(N(R<t RadiobuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs,|j}|j|ddddddS(NR-igffffff@Rs any string(RR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_values csgfd}tj|j}tj|jd|d|dd}tj|jd|d|dd}|jrd}nt}|j}|j|d|j||d|j |j|j ||j j |d|j d |d<|j}|jt |d |jtd|j||d|j |j|j ||j j |d|jt |dt |ddS( NcsjddS(Niscb test called(R((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs RRR-iicSs|S(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRscb test calledR(RGtIntVarR>R<R.RR)RRRRRRRRR(RRtmyvarRtcbtn2tconvR((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs0        (RRRR]RR!RSR.R`R8RRgR-RR7(R4R5RcRR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR,s  tMenubuttonTestcBs)eZdZdZdZdZRS(RRR]t directionRtmenuR!RSR.R`R8RRgR7cKstj|j|S(N(R<t MenubuttonR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs/|j}|j|dddddddS(NR5tabovetbelowRRtflush(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_directions  cCsH|j}tj|dd}|j|d|dt|jdS(NRyR6R3(RRGtMenuR,RR|(RRR6((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_menus (RRR]R5RR6R!RSR.R`R8RRgR7(R4R5RcRR;R=(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR4s  t ScaleTestc BskeZdZeZd Zd Zd ZdZdZ dZ dZ dZ dZ dZRS(RRR]tfromtlengthR R.R`ttoR-RRcCs@tt|j|j|_|jj|jjdS(N(R:R>R;RtscaleR?R(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;s cKstj|j|S(N(R<tScaleR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs/|j}|j|dddddtdS(NR?idg-@g333333.@R3(RtcheckFloatParamR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_froms cCs,|j}|j|ddddddS(NR@igffffff`@g33333`@t5i(RtcheckPixelsParam(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_lengths c Cs2|j}|j|ddddddtdS(NRAi,g-@g333333.@iR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_to s c Cs2|j}|j|ddddddtdS(NR-i,g-@g333333.@iR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/s csdddg|jjdfd}d|jd>cs jS(N(tpop(R(tfailure(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRi R?tfrom_iRAiiii(RBRRR(Rtfuncid((RKs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_custom_events    cCs|jrd}nt}|jj}|j|jj|d|jd|j||jjdd||jd|j|jj|jdd|jd<|j|jj|jd|jtj|jjdd|jtj|jjdddS(NcSs|S(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR(RiRAR?R-iR( RtfloatRBRDRRRFRGR(RR3t scale_width((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_get&s  &2   cCs|jrd}nt}||jd}|d}|jj||j||jj|||jd}|jj|d|j||jj|tj|j}||jd<|j|d|j||jj|j|j||jj|d~|d|jd<|j||jj|d|j||jj||jd|j||jjd d ||j||jj|jj d ||j tj |jjddS( NcSs|S(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR:RRAi R?iRiR-i( RRORBRRRRGt DoubleVarR>RDRFRRH(RR3tmaxtnew_maxtmintvar((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_set8s,    %##,%.( RRR]R?R@R R.R`RAR-R(R4R5RcR RZR/R;RRERHRIR/RNRQRW(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR>s        tProgressbarTestc BsPeZdZeZd Zd Zd ZdZdZ dZ dZ RS(RR]R R@tmodetmaximumtphaseR.R`R-RRcKstj|j|S(N(R<t ProgressbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRfscCs)|j}|j|dddddS(NR@gfffffY@gYL@t2i(RRG(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRHis c Cs2|j}|j|ddddddtdS(NRZgfffffb@glS@iiR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_maximumms cCs&|j}|j|ddddS(NRYt determinatet indeterminate(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_modeqs cCsdS(N((R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_phaseusc Cs2|j}|j|ddddddtdS(NR-gfffffb@glS@iiR3(RRDR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR/ys ( RR]R R@RYRZR[R.R`R-R( R4R5RcR RZR/RRHR^RaRbR/(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRX\s     Rs"ttk.Scrollbar is special on MacOSXt ScrollbarTestcBseZdZdZdZRS( RRR]R R.R`RcKstj|j|S(N(R<t ScrollbarR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs(RRR]R R.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRcst NotebookTestcBsqeZdZdZdZd Zd Zd Zd Zd Z dZ dZ dZ dZ RS(RR]R^R!R.R`R7cCstt|j|jdd|_tj|j|_tj|j|_ |jj |jdd|jj |j dddS(NR!iR8RR#( R:ReR;RtnbR<R{R>tchild1RR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;s cKstj|j|S(N(R<tNotebookR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRscCs|jjd|jj|j|jtj|jj|j|j |jj dd|jj |j|j |jj dd|jj |j|j |jjd|jj |jdd|jj|jjtjdkrd}nd }|j |jj||jjdxhtd d d D]G}y*|jjd |dddkrtPnWqEtjk rqEXqEW|jd dS(NiRiRR8RRs@20,5s@5,5iids@%d, 5sTab with text 'a' not found(RfRthideRRFRGRttabRgRtindexRtselectRR?R@RRtrangeRHtfail(Rttb_idxti((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab_identifierss,   ("cCs|jtj|jjd|jtj|jjd|jtj|jjd|jtj|jjd|jtj|jjtj|j dd|jj }|jj|j |jj|j |j |jj |tj|j }|jj|dd|jj }|jj d}|jj |j}|jj|j|jj|j|j |jj ||j |jj |j||j t|j|jj ||j |jj d|ddS( NiROtunknowntoptionR8RRi(RFRGRRfRiRHRR<R{R>ttabsRgRRkRR(RRtRtcurrt child2_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_add_and_hiddens*'&cCs+|jtj|jjd|jtj|jjd|jtj|jjd|jj}|jj|j}|jj|j|j t |j|jj|j t |dt |jj|jj |j|j |jj|jd|j||jj|jdS(NiROi(RFRGRRfRRHRtRkRgt assertNotInRRRRR((RRtt child1_index((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs")cCs|jtj|jjd|jtj|jjd|j|jjdt|j|jj|j d|j|jj|j d|j|jjdddS(NiRiii( RFRGRRfRkRHR R)RRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_indexs cCs|jj}|jjd|d|j|jj|d|df|jj|j|j|j|jj||jjd|j|j|jj|d|df|jjdd|j|jj||jtj|jjd|d|jtj|jjd|dt j |j }|jjd||j|jj|dt ||df|jj ||j|jj||jj|j||j|jjt |f||jj ||jtj|jjd||jtj|jjd||jtj|jjdd|jtj|jjdd|jtj|jjdddS(NiiRii(RfRtRRRgRRFRGRR<R{R>RRRH(RRtR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs0''##0&cs|jj|jjgg|jjdfd|jjdfd|j|jjt|j|jj|j|j |j|jjt|j|jj |j dS(Nscs jtS(N(RRU(R(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRRs<>cs jtS(N(RRU(R(t tab_changed(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRR( RfR?R@RgRRRlRRRR(R((RR{s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_selects   " " cCs|jtj|jjd|jtj|jjd|jtj|jjd|j|jj|jt|j |jj|jddd|j |jj|jdd|jj|jdd|j |jj|jddd|j |jj|jdddS(NitnotabR8Rtabc( RFRGRRfRjRHR RgR!R(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tab(s%"%cCsb|jt|jjd|jj|j|jj|j|j|jjddS(Ni((RRRfRtRRgR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_tabs6scCs|jj|jj|jjdt|jdd|jj|jjd|j|jjt|j |jj|jjd|j|jjt|j |jj|jjd|j|jjt|j |jj |j dddd|jj |jjt|jddt jdkrh|jjd n|jjd |j|jjt|j dS( Niis sR8RRgRs s(RfR?R@RlR t focus_forceRRRRRgRjtenable_traversalRR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_traversal?s*   " " "  (RR]R^R!R.R`R7(R4R5RcR;RRqRwRRzRR|RRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRes      !   t TreeviewTestc BseZd#Zd Zd ZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZd Zd!Zd"ZRS($RtcolumnsR]tdisplaycolumnsR^R!t selectmodeRR.R`RtyscrollcommandcCs,tt|j|jdd|_dS(NR!i(R:RR;Rttv(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;cscKstj|j|S(N(R<tTreeviewR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRgscCsa|j}|j|dddd |j|dd |j|dtd krVd nd dS(NRsa b cR"RR#RiiR(RR#R(RR#R(ii((RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_columnsjs  cCs|j}d|d<|j|dddd|j|dd|j|dddd|j|dd|j|ddd d|j|ddd d|j|ddd ddS(NRR#RRRsb a cR"s#alliiiRRsInvalid column index disColumn index 3 out of boundsisColumn index -2 out of bounds(RR#R(R#RR(R#RR(s#all(iii(RR#R(iii(ii(RR,R(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_displaycolumnsqs  c CsN|j}|j|ddddddt|j|ddddtdS( NR^idiit3cR3gLY@gfffffY@(RRGRR (RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs "cCs)|j}|j|dddddS(NRRtbrowsetextended(RRv(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selectmodes  cCs|j}|j|dddd|j|dd|j|dd|j|dddd |j|dddd dS( NRs tree headingsR"ttreetheadings(RR(RR(RR(R(R(RR,(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs cCsW|jj|j|jjdd|jj|jj|jjdd}|jj}|j||jj|d}|j |dg|jd<|jj ddd|jj|dd}|jj ddd}|j st |}n|j|d|d||jj|d}|j|jj|ddS( NRRittestRR7i2s#0(RR?RRR@RRt get_childrenRRtcolumnRHRR)(Rtitem_idtchildrenRt bbox_column0t root_widthRg((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs$      cCs>|j|jjd|jjdd}|j|jjt|j|jjd||jjdd}|jjdd}|jj||||j|jj|||f|jtj |jj|||jj||j|jj|d|jjd|j|jjddS(NRRi(((( RRRRR ttuplet set_childrenRFRGR(RRRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_childrens" cCsi|j|jjdt|jrJ|j|jjdddtn|jjddd|j|jjdd|jrdnd|j|jjddd|jrdnd|jt j |jjddd|jt j |jjdidd 6id d 6id d 6id d6id d 6g}x-|D]%}|jt j |jjd|q<WdS(Ns#0R7i t10tidtXRs some valuetunknown_optiontwrongtstretchRtminwidth( R RRR!RRHR)RRFRGR(Rt invalid_kwsRM((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_columns %"$ cCs?|jtj|jjd|jjdd}|jj|d}|j|jj|f|j|jj||f|jj||j|jj|jtj|jj |dd|jjdd}|jjdd}|j|jj||f|jj|||j|jjdS(Ns#0RR( RFRGRRRRRRRtreattach(RRtitem2titem1((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_deletes cCs0|jjdd}|jj|d}|jj}|jj|j||jj|j|jj|f|j|jj||f|jj||j|jj|jj|dd|j|jj|f|j|jj||f|jj|dd|j|jj||f|j|jj|d|jt j |jjddd|jt j |jjd|jt j |jj|dd|jt j |jj|dd|jj|||j|jjd|j|jj|ddS( NRRt nonexistentt otherparentR(((( RRRtdetachRRRtmoveRFRGR(RRRtprev((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_detach_reattachs4     cCst|j|jjdt|j|jjdt|j|jjit|jtj|jjddS(Nt somethingR( RRtexistsRRURFRGRRH(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_exists'scCs|j|jjd|jjdd}|jj||j|jj||jj||j|jjd|jtj|jjddS(NRRRO(RRRRRRFRGR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_focus2scCs|j|jjdt|jjddd|j|jjddd|j|jjdddd|jtj|jjddd|jtj|jjddddS(Ns#0R8RORRi( R RtheadingR!RRHRFRGR(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_headingAs"csfd}gjjjjjjddfdjjdddjj|ddsjdngjjj}jjddt jjdddj |jjj|ddsjdndS( Ncs$tj||jjdS(N(R RR(RR(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytsimulate_heading_clickRss#0Rcs jtS(N(RRU((R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRZRR7idis>The command associated to the treeview heading wasn't invoked.( RR?R@RRRRnRt _tclCommandsRRHR(RRtcommands((RRs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_heading_callbackQs"    . cCs|jtj|jjd|j|jjdd|jjdd}|jjdd}|jj|d}|jj|d}|j|jj|d|j|jj|d|j|jj|d|j|jj|d|jj|dd|j|jj|d|j|jj|d|jj||j|jj|d|jj||j|jj|d|jj ||jtj|jj|dS(NtwhatRiRi( RFRGRRRkRRRRR(RRRtc1tc2((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRzss&cCs|jtj|jjdd|jtj|jjdddd|jtj|jjdddd|j|jj|jjdddt|j|jj|jjdddt|jtj|jjdd|jjddd}|j |d|jtj|jjddd|jtj|jjddt dd}|jjddd |f}|j |jj |d |j r|fn||j |jj |d d|j r|fn||jj |d |jj|jj |d d|j |jj |d d|j r@|fn||j|jj |t|jj |d d|j|jj |d d|jjddd d d |g}|j |jj |d d|j rd d|fnd||jj |d g|j|jj |d d|jj |d d|j |jj |d d|j rodnd|jjddd dd||ff}|j |jj |d d|j rdd||ffn d||f|j |jj |jjddddddd|j |jj |jjddd|dd||jjddd}|j |d|jjddd}|j |d|jtj|jjddt|jtj|jjddddS(NRRRtopentpleasetmiddles first-itemuábaRttagsiiRRs1 2 %ss1 2sa b cs%s %ss{a b c} {%s %s}R8s Label hereiR#gs0.0(ii(RR(RFRGRRRRRRURRRtitemRRHR>t splitlistR R!(RtitemidR-R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_insert_itemsh.. 4$ !!"cCs|jtj|jjd|jtj|jjd|jtj|jjd|jtj|jjd|jjdd}|jjdd}|jj|d}|jj|d}|jj|d}|j |jj d |jj||f|j |jj ||f|jj||j |jj |f|jj||f|j |jj |||f|jj||j |jj ||||f|jj||f|j |jj |||f|jj||j |jj ||f|jj||f|j |jj ||f|jj||j |jj |f|jjdddd|jjd|j |jj d |jjdddd|jjd|j |jj d t rl|jjdddt d|jjt d|j |jj t dfn|jjdddd|jjd|j |jj t rt d ndfdS( NRRRRs with spacess{braces unicode\u20acsbytes€s bytes\u20ac((s with spaces(s{brace( RFRGRRt selection_sett selection_addtselection_removetselection_toggleRRt selectionRR(RRRRRtc3((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_selectionsR"%"%cCsPddg|jd<|jjdddddg}|j|jj|idd6dd6|jj|dd|j|jj|dd|jrdnd dg|jd<|j|jj|idd6|jj|dd|j|jj|d dd|j|jj|dd|jr:dnd |jj|dd |j|jj|d|jr~d nd |j|jj|dd|jrdnd|j|jj||jrid d6n id d6|jtj |jj|d|jtj |jj|dd|jtj |jjddS(NtAtBRRRRRR#sa aRsb ai{t123s123 atnotme(RR(R#R(i{R( RRRRRRHRRFRGR(RR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRWs,!*#"$"c sg|jjddddg}|jjddddg}|jjddfd|jjddfd|jj|jj|jjt}t}xqtd d d D]]}t|d krPn|jj |}|r||kr|j ||j |qqW|j t|d x!|D]}t |jd |qJW|j td xAt ddd ddd D]}|j |dqWdS(NRRRtcallscs jdS(Ni(R(R(tevents(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR;Rscs jdS(Ni(R(R(R(s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR=Riidi iii(ii(RRttag_bindR?R@RRRmRt identify_rowRRR tzip( RRRtpos_ytfoundRpRRR((Rs9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_tag_bind6s2       0cCs|jt|jj|jtj|jjddd|jjddd|jt|jjddd|jt|jjdddd|j |jjdt dS(NRtskytblueR( RFt TypeErrorRt tag_configureRGRRRRHR R!(R((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyttest_tag_configureXs !cCs|jjddddddg}|jjddddddg}|jt|jj|jt|jjdd |j|jjd||j|jjd||j|jjd||j|jjd||j|jjd ||j|jjd ||j|jjd|f|j|jjd|f|j|jjd d dS( NRRR8sItem 1Rttag1sItem 2ttag2s non-existingttag3(( RRRFRttag_hasRRRR(RRR((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyt test_tag_hasds$$( RRR]RR^R!RRR.R`RR(R4R5RcR;RRRRRRRRRRRRRRRRzRRRWRRR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR[s4           *   "  M 6 ! " t SeparatorTestcBseZdZdZdZRS(RR]R R.R`RcKstj|j|S(N(R<t SeparatorR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyR|s(RR]R R.R`(R4R5RcR/R(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRtst SizegripTestcBseZdZdZRS(RR]R.R`cKstj|j|S(N(R<tSizegripR>(RRb((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRs(RR]R.R`(R4R5RcR(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pyRst__main__(5tunittesttTkinterRGRR<ttest.test_supportRRRRRttest_functionsRtsupportRRRR t widget_testsR R R R RRRRRtTestCaseR6RYR[RdR~RRRRRR R,R4R>RXtskipIfRRcReRRRt tests_guiR4(((s9/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.pytsr   " ": ';     0| 3 j "          PK! __init__.pynu[PK!p ;__init__.pycnu[PK!p __init__.pyonu[PK!M,7 support.pynu[PK!@ S support.pycnu[PK!@ S %support.pyonu[PK!B,,:test_extensions.pynu[PK!ž''gtest_extensions.pycnu[PK!ž''܏test_extensions.pyonu[PK!GCCܷtest_functions.pynu[PK!d67>>test_functions.pycnu[PK!d67>>:test_functions.pyonu[PK!ܐb b ytest_style.pynu[PK!M3 Ctest_style.pycnu[PK!M3 btest_style.pyonu[PK!Vtest_widgets.pynu[PK!8Otest_widgets.pycnu[PK!8test_widgets.pyonu[PKp