[Python-checkins] [3.7] bpo-34189: Add simple tests for new Tk widget options. (GH-8396) (GH-8398)

Serhiy Storchaka webhook-mailer at python.org
Sun Jul 22 15:14:19 EDT 2018


https://github.com/python/cpython/commit/c7b91d95d8890a4bafefa797f194a1ae3f0f0abb
commit: c7b91d95d8890a4bafefa797f194a1ae3f0f0abb
branch: 3.7
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-07-22T22:14:15+03:00
summary:

[3.7] bpo-34189: Add simple tests for new Tk widget options. (GH-8396) (GH-8398)

(cherry picked from commit e271ca78e37a502b3dc1036f824aa3999efcd56b)
(cherry picked from commit c75c1e0e8aeb720ac3fcfab119b70cabba4e8235)

files:
M Lib/tkinter/test/support.py
M Lib/tkinter/test/test_tkinter/test_widgets.py

diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py
index dd155fad0fd0..0d9a65a5cc83 100644
--- a/Lib/tkinter/test/support.py
+++ b/Lib/tkinter/test/support.py
@@ -1,3 +1,4 @@
+import functools
 import re
 import tkinter
 import unittest
@@ -54,9 +55,20 @@ def simulate_mouse_click(widget, x, y):
 tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))
 
 def requires_tcl(*version):
-    return unittest.skipUnless(tcl_version >= 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() < (8, 6, 5):
+                self.skipTest('requires Tcl version >= ' +
+                                '.'.join(map(str, get_tk_patchlevel())))
+            test(self)
+        return newtest
+    return deco
+
 _tk_patchlevel = None
 def get_tk_patchlevel():
     global _tk_patchlevel
diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py
index 81b52eafea9a..e4c9d337ba7d 100644
--- a/Lib/tkinter/test/test_tkinter/test_widgets.py
+++ b/Lib/tkinter/test/test_tkinter/test_widgets.py
@@ -703,7 +703,7 @@ class ListboxTest(AbstractWidgetTest, unittest.TestCase):
         'disabledforeground', 'exportselection',
         'font', 'foreground', 'height',
         'highlightbackground', 'highlightcolor', 'highlightthickness',
-        'listvariable', 'relief',
+        'justify', 'listvariable', 'relief',
         'selectbackground', 'selectborderwidth', 'selectforeground',
         'selectmode', 'setgrid', 'state',
         'takefocus', 'width', 'xscrollcommand', 'yscrollcommand',
@@ -717,6 +717,8 @@ def test_activestyle(self):
         self.checkEnumParam(widget, 'activestyle',
                             'dotbox', 'none', 'underline')
 
+    test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify)
+
     def test_listvariable(self):
         widget = self.create()
         var = tkinter.DoubleVar(self.root)
@@ -951,7 +953,9 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
     OPTIONS = (
         'background', 'borderwidth', 'cursor',
         'handlepad', 'handlesize', 'height',
-        'opaqueresize', 'orient', 'relief',
+        'opaqueresize', 'orient',
+        'proxybackground', 'proxyborderwidth', 'proxyrelief',
+        'relief',
         'sashcursor', 'sashpad', 'sashrelief', 'sashwidth',
         'showhandle', 'width',
     )
@@ -978,6 +982,23 @@ def test_opaqueresize(self):
         widget = self.create()
         self.checkBooleanParam(widget, 'opaqueresize')
 
+    @requires_tcl(8, 6, 5)
+    def test_proxybackground(self):
+        widget = self.create()
+        self.checkColorParam(widget, 'proxybackground')
+
+    @requires_tcl(8, 6, 5)
+    def test_proxyborderwidth(self):
+        widget = self.create()
+        self.checkPixelsParam(widget, 'proxyborderwidth',
+                              0, 1.3, 2.9, 6, -2, '10p',
+                              conv=noconv)
+
+    @requires_tcl(8, 6, 5)
+    def test_proxyrelief(self):
+        widget = self.create()
+        self.checkReliefParam(widget, 'proxyrelief')
+
     def test_sashcursor(self):
         widget = self.create()
         self.checkCursorParam(widget, 'sashcursor')



More information about the Python-checkins mailing list