Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make test_tk ScaleTest test_from platform sensitive.
On Windows tk 8.6.10, tk Scale no longer rounds 'from',
thus matching ttk Scale behavior.
  • Loading branch information
terryjreedy committed Sep 25, 2020
commit 9bcec1b231ad0785c34ea1e84c683be3f39296f8
3 changes: 2 additions & 1 deletion Lib/tkinter/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,8 @@ def test_digits(self):

def test_from(self):
widget = self.create()
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
cvt = False if sys.platform == 'win32' else float_round # 39107
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka Sep 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should depend not on platform, but on Tk version. Use get_tk_patchlevel().

Also, it would be better to use name conv instead of cvt for consistency.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. However, I could not fine that name in either tkinter or _tkinter, so I used the tk call used in idlelib.help_about. I used an equality check. But it would not work for an 8.6.11. Is such possible?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_tk_patchlevel is defined in tkinter.test.support and is already imported in this file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serhiy, do you prefer passing False, as the ttk Scale test does, or 'noconv', as in #21715?
Do you want a comment added, such as in the other PR?
Please decide whether you want to close the other issue and PR or merge it and remove the test change here.
Either way, I would like to get this merged so we can routinely test tkinter and IDLE on Windows with 8.6.10 in place.

self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=cvt)

def test_label(self):
widget = self.create()
Expand Down