mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839)
This commit is contained in:
parent
7aeb06f78e
commit
c2e3c06139
10 changed files with 90 additions and 216 deletions
|
@ -4,7 +4,7 @@ import tkinter
|
|||
from tkinter import TclError
|
||||
from test.support import requires
|
||||
|
||||
from tkinter.test.support import pixels_conv, tcl_version, requires_tcl
|
||||
from tkinter.test.support import pixels_conv
|
||||
from tkinter.test.widget_tests import AbstractWidgetTest
|
||||
|
||||
requires('gui')
|
||||
|
@ -295,8 +295,7 @@ class PlaceTest(AbstractWidgetTest, unittest.TestCase):
|
|||
with self.assertRaisesRegex(TclError, "can't place %s relative to "
|
||||
"itself" % re.escape(str(f2))):
|
||||
f2.place_configure(in_=f2)
|
||||
if tcl_version >= (8, 5):
|
||||
self.assertEqual(f2.winfo_manager(), '')
|
||||
self.assertEqual(f2.winfo_manager(), '')
|
||||
with self.assertRaisesRegex(TclError, 'bad window path name'):
|
||||
f2.place_configure(in_='spam')
|
||||
f2.place_configure(in_=f)
|
||||
|
@ -491,8 +490,7 @@ class GridTest(AbstractWidgetTest, unittest.TestCase):
|
|||
for i in range(rows + 1):
|
||||
self.root.grid_rowconfigure(i, weight=0, minsize=0, pad=0, uniform='')
|
||||
self.root.grid_propagate(1)
|
||||
if tcl_version >= (8, 5):
|
||||
self.root.grid_anchor('nw')
|
||||
self.root.grid_anchor('nw')
|
||||
super().tearDown()
|
||||
|
||||
def test_grid_configure(self):
|
||||
|
@ -619,16 +617,14 @@ class GridTest(AbstractWidgetTest, unittest.TestCase):
|
|||
self.root.grid_columnconfigure((0, 3))
|
||||
b = tkinter.Button(self.root)
|
||||
b.grid_configure(column=0, row=0)
|
||||
if tcl_version >= (8, 5):
|
||||
self.root.grid_columnconfigure('all', weight=3)
|
||||
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
|
||||
self.root.grid_columnconfigure('all')
|
||||
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 3)
|
||||
self.root.grid_columnconfigure('all', weight=3)
|
||||
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
|
||||
self.root.grid_columnconfigure('all')
|
||||
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 3)
|
||||
self.assertEqual(self.root.grid_columnconfigure(3, 'weight'), 2)
|
||||
self.assertEqual(self.root.grid_columnconfigure(265, 'weight'), 0)
|
||||
if tcl_version >= (8, 5):
|
||||
self.root.grid_columnconfigure(b, weight=4)
|
||||
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 4)
|
||||
self.root.grid_columnconfigure(b, weight=4)
|
||||
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 4)
|
||||
|
||||
def test_grid_columnconfigure_minsize(self):
|
||||
with self.assertRaisesRegex(TclError, 'bad screen distance "foo"'):
|
||||
|
@ -675,16 +671,14 @@ class GridTest(AbstractWidgetTest, unittest.TestCase):
|
|||
self.root.grid_rowconfigure((0, 3))
|
||||
b = tkinter.Button(self.root)
|
||||
b.grid_configure(column=0, row=0)
|
||||
if tcl_version >= (8, 5):
|
||||
self.root.grid_rowconfigure('all', weight=3)
|
||||
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
|
||||
self.root.grid_rowconfigure('all')
|
||||
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 3)
|
||||
self.root.grid_rowconfigure('all', weight=3)
|
||||
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
|
||||
self.root.grid_rowconfigure('all')
|
||||
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 3)
|
||||
self.assertEqual(self.root.grid_rowconfigure(3, 'weight'), 2)
|
||||
self.assertEqual(self.root.grid_rowconfigure(265, 'weight'), 0)
|
||||
if tcl_version >= (8, 5):
|
||||
self.root.grid_rowconfigure(b, weight=4)
|
||||
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 4)
|
||||
self.root.grid_rowconfigure(b, weight=4)
|
||||
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 4)
|
||||
|
||||
def test_grid_rowconfigure_minsize(self):
|
||||
with self.assertRaisesRegex(TclError, 'bad screen distance "foo"'):
|
||||
|
@ -774,7 +768,6 @@ class GridTest(AbstractWidgetTest, unittest.TestCase):
|
|||
self.assertEqual(info['pady'], self._str(4))
|
||||
self.assertEqual(info['sticky'], 'ns')
|
||||
|
||||
@requires_tcl(8, 5)
|
||||
def test_grid_anchor(self):
|
||||
with self.assertRaisesRegex(TclError, 'bad anchor "x"'):
|
||||
self.root.grid_anchor('x')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue