bpo-45979: Fix Tkinter tests with old Tk (>= 8.5.12) (GH-31938)

(cherry picked from commit dbbe4d2d00)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-03-17 00:29:37 -07:00 committed by GitHub
parent 4e9bb27eae
commit 612019e60e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -800,7 +800,7 @@ def test_configure_activestyle(self):
self.checkEnumParam(widget, 'activestyle', self.checkEnumParam(widget, 'activestyle',
'dotbox', 'none', 'underline') 'dotbox', 'none', 'underline')
test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_configure_justify) test_configure_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_configure_justify)
def test_configure_listvariable(self): def test_configure_listvariable(self):
widget = self.create() widget = self.create()
@ -939,7 +939,7 @@ def test_configure_digits(self):
def test_configure_from(self): def test_configure_from(self):
widget = self.create() widget = self.create()
conv = False if get_tk_patchlevel() >= (8, 6, 10) else float_round conv = float if get_tk_patchlevel() >= (8, 6, 10) else float_round
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=conv) self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=conv)
def test_configure_label(self): def test_configure_label(self):

View file

@ -4,7 +4,7 @@
from tkinter import ttk from tkinter import ttk
from test import support from test import support
from test.support import requires from test.support import requires
from tkinter.test.support import AbstractTkTest from tkinter.test.support import AbstractTkTest, get_tk_patchlevel
requires('gui') requires('gui')
@ -170,6 +170,8 @@ def test_map_custom_copy(self):
newname = f'C.{name}' newname = f'C.{name}'
self.assertEqual(style.map(newname), {}) self.assertEqual(style.map(newname), {})
style.map(newname, **default) style.map(newname, **default)
if theme == 'alt' and name == '.' and get_tk_patchlevel() < (8, 6, 1):
default['embossed'] = [('disabled', '1')]
self.assertEqual(style.map(newname), default) self.assertEqual(style.map(newname), default)
for key, value in default.items(): for key, value in default.items():
self.assertEqual(style.map(newname, key), value) self.assertEqual(style.map(newname, key), value)