[Python-checkins] cpython (2.7): Issue #19085: Fix Tkinter tests with Tcl/Tk 8.4.
serhiy.storchaka
python-checkins at python.org
Sat Nov 2 16:28:24 CET 2013
http://hg.python.org/cpython/rev/278d15021d9a
changeset: 86843:278d15021d9a
branch: 2.7
parent: 86838:0554e2d37bf8
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Nov 02 17:27:59 2013 +0200
summary:
Issue #19085: Fix Tkinter tests with Tcl/Tk 8.4.
files:
Lib/lib-tk/test/test_tkinter/test_widgets.py | 12 ++++----
Lib/lib-tk/test/test_ttk/test_widgets.py | 14 +++++-----
Lib/lib-tk/test/widget_tests.py | 3 +-
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py
--- a/Lib/lib-tk/test/test_tkinter/test_widgets.py
+++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py
@@ -4,7 +4,7 @@
from test.test_support import requires, run_unittest
from test_ttk.support import tcl_version, requires_tcl, widget_eq
-from widget_tests import (add_standard_options, noconv, int_round,
+from widget_tests import (add_standard_options, noconv, noconv_meth, int_round,
AbstractWidgetTest, StandardOptionsTests,
IntegerSizeTests, PixelSizeTests)
@@ -12,7 +12,7 @@
class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
- _conv_pad_pixels = noconv
+ _conv_pad_pixels = noconv_meth
def test_class(self):
widget = self.create()
@@ -130,7 +130,7 @@
class AbstractLabelTest(AbstractWidgetTest, IntegerSizeTests):
- _conv_pixels = noconv
+ _conv_pixels = noconv_meth
def test_highlightthickness(self):
widget = self.create()
@@ -240,7 +240,7 @@
'takefocus', 'text', 'textvariable',
'underline', 'width', 'wraplength',
)
- _conv_pixels = AbstractWidgetTest._conv_pixels
+ _conv_pixels = staticmethod(AbstractWidgetTest._conv_pixels)
def _create(self, **kwargs):
return Tkinter.Menubutton(self.root, **kwargs)
@@ -858,7 +858,7 @@
'postcommand', 'relief', 'selectcolor', 'takefocus',
'tearoff', 'tearoffcommand', 'title', 'type',
)
- _conv_pixels = noconv
+ _conv_pixels = noconv_meth
def _create(self, **kwargs):
return Tkinter.Menu(self.root, **kwargs)
@@ -894,7 +894,7 @@
'justify', 'padx', 'pady', 'relief',
'takefocus', 'text', 'textvariable', 'width',
)
- _conv_pad_pixels = noconv
+ _conv_pad_pixels = noconv_meth
def _create(self, **kwargs):
return Tkinter.Message(self.root, **kwargs)
diff --git a/Lib/lib-tk/test/test_ttk/test_widgets.py b/Lib/lib-tk/test/test_ttk/test_widgets.py
--- a/Lib/lib-tk/test/test_ttk/test_widgets.py
+++ b/Lib/lib-tk/test/test_ttk/test_widgets.py
@@ -7,7 +7,7 @@
import support
from test_functions import MockTclObj, MockStateSpec
from support import tcl_version
-from widget_tests import (add_standard_options, noconv,
+from widget_tests import (add_standard_options, noconv, noconv_meth,
AbstractWidgetTest, StandardOptionsTests,
IntegerSizeTests, PixelSizeTests)
@@ -117,7 +117,7 @@
class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
- _conv_pixels = noconv
+ _conv_pixels = noconv_meth
@add_standard_options(StandardTtkOptionsTests)
@@ -197,7 +197,7 @@
'takefocus', 'text', 'textvariable',
'underline', 'width', 'wraplength',
)
- _conv_pixels = noconv
+ _conv_pixels = noconv_meth
def _create(self, **kwargs):
return ttk.Label(self.root, **kwargs)
@@ -362,7 +362,7 @@
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', '')
+ self.checkParam(self.combo, 'values', () if tcl_version < (8, 5) else '')
self.combo['values'] = ['a', 1, 'c']
@@ -758,7 +758,7 @@
'class', 'command', 'cursor', 'from', 'length',
'orient', 'style', 'takefocus', 'to', 'value', 'variable',
)
- _conv_pixels = noconv
+ _conv_pixels = noconv_meth
default_orient = 'horizontal'
def setUp(self):
@@ -862,7 +862,7 @@
'mode', 'maximum', 'phase',
'style', 'takefocus', 'value', 'variable',
)
- _conv_pixels = noconv
+ _conv_pixels = noconv_meth
default_orient = 'horizontal'
def _create(self, **kwargs):
@@ -1144,7 +1144,7 @@
self.checkParam(widget, 'columns', 'a b c',
expected=('a', 'b', 'c'))
self.checkParam(widget, 'columns', ('a', 'b', 'c'))
- self.checkParam(widget, 'columns', '')
+ self.checkParam(widget, 'columns', () if tcl_version < (8, 5) else '')
def test_displaycolumns(self):
widget = self.create()
diff --git a/Lib/lib-tk/test/widget_tests.py b/Lib/lib-tk/test/widget_tests.py
--- a/Lib/lib-tk/test/widget_tests.py
+++ b/Lib/lib-tk/test/widget_tests.py
@@ -6,6 +6,7 @@
noconv = str if tcl_version < (8, 5) else False
+noconv_meth = noconv and staticmethod(noconv)
def int_round(x):
return int(round(x))
@@ -13,7 +14,7 @@
_sentinel = object()
class AbstractWidgetTest(object):
- _conv_pixels = staticmethod(int_round) if tcl_version[:2] != (8, 5) else int
+ _conv_pixels = staticmethod(int_round if tcl_version[:2] != (8, 5) else int)
_conv_pad_pixels = None
wantobjects = True
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list