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\xe1l\u0169\xe8') self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [('a', 'b', u'v\xe1l\u0169\xe8')]}) self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}), {'x': ['y z']})
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_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'), text('válũè')) self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': [('a', 'b', text('válũè'))]}) self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}), {'x': ['y z']})
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_multivalues(self): adict = {'opt': [1, 2, 3, 4]} self.failUnlessEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 2, 3, 4]}) adict['opt'] = [1, 'xm', 3] self.failUnlessEqual(ttk.tclobjs_to_py(adict), {'opt': [1, 'xm', 3]}) adict['opt'] = (MockStateSpec('a', 'b'), u'válũè') self.failUnlessEqual(ttk.tclobjs_to_py(adict), {'opt': [('a', 'b', u'válũè')]}) self.failUnlessEqual(ttk.tclobjs_to_py({'x': ['y z']}), {'x': ['y z']})
def __getitem__(self, item): if item in ('year', 'month'): return getattr(self._date, item) elif item == 'selectbackground': return self._canvas['background'] elif item == 'selectforeground': return self._canvas.itemcget(self._canvas.text, 'fill') else: r = ttk.tclobjs_to_py({item: ttk.Frame.__getitem__(self, item)}) return r[item]
def __getitem__(self, item): if item in ("year", "month"): return getattr(self._date, item) elif item == "selectbackground": return self._canvas["background"] elif item == "selectforeground": return self._canvas.itemcget(self._canvas.text, "fill") else: r = ttk.tclobjs_to_py({item: ttk.Frame.__getitem__(self, item)}) return r[item]
def test_nosplit(self): self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}), {'text': 'some text'})
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_nosplit(self): self.failUnlessEqual(ttk.tclobjs_to_py({'text': 'some text'}), {'text': 'some text'})
def test_unicode(self): adict = {'opt': 'välúè'} self.failUnlessEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'}) adict['opt'] = MockTclObj(adict['opt']) self.failUnlessEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
def test_nosplit(self): self.assertEqual(ttk.tclobjs_to_py({"text": "some text"}), {"text": "some text"})
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úè"})