예제 #1
0
 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'), 'válũè'
     self.assertEqual(ttk.tclobjs_to_py(adict),
                      {'opt': [('a', 'b', 'válũè')]})
     self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}), {'x': ['y z']})
예제 #2
0
    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"), "válũè")
        self.failUnlessEqual(ttk.tclobjs_to_py(adict), {"opt": [("a", "b", "válũè")]})

        self.failUnlessEqual(ttk.tclobjs_to_py({"x": ["y z"]}), {"x": ["y z"]})
예제 #3
0
    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'), 'válũè')
        self.assertEqual(ttk.tclobjs_to_py(adict),
            {'opt': [('a', 'b', 'válũè')]})

        self.assertEqual(ttk.tclobjs_to_py({'x': ['y z']}),
            {'x': ['y z']})
예제 #4
0
 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]
예제 #6
0
 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]
예제 #7
0
 def test_nosplit(self):
     self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}),
                      {'text': 'some text'})
예제 #8
0
 def test_unicode(self):
     adict = {'opt': 'välúè'}
     self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
     adict['opt'] = MockTclObj(adict['opt'])
     self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
예제 #9
0
 def test_nosplit(self):
     self.assertEqual(ttk.tclobjs_to_py({'text': 'some text'}),
         {'text': 'some text'})
예제 #10
0
    def test_unicode(self):
        adict = {'opt': 'välúè'}
        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})

        adict['opt'] = MockTclObj(adict['opt'])
        self.assertEqual(ttk.tclobjs_to_py(adict), {'opt': 'välúè'})
예제 #11
0
 def test_nosplit(self):
     self.failUnlessEqual(ttk.tclobjs_to_py({"text": "some text"}), {"text": "some text"})
예제 #12
0
    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úè"})
예제 #13
0
 def test_nosplit(self):
     self.assertEqual(ttk.tclobjs_to_py({"text": "some text"}), {"text": "some text"})