diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-09-01 12:23:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 15:23:27 -0400 |
commit | bb8e49b4203fc1f2df554b452dbd3926102b18ee (patch) | |
tree | fdc6bd5323f879264a25988d2ac55403aab084b8 | |
parent | c19983125a42a4b4958b11a26ab5e03752c956fc (diff) | |
download | cpython-git-bb8e49b4203fc1f2df554b452dbd3926102b18ee.tar.gz |
bpo-41306: Allow scale value to not be rounded (GH-21715) (GH-96484)
This fixes the test failure with Tk 6.8.10 which is caused by changes to how Tk rounds the `from`, `to` and `tickinterval` arguments. This PR uses `noconv` if the patchlevel is greater than or equal to 8.6.10 (credit to Serhiy for this idea as it is much simpler than what I previously proposed).
Going into more detail for those who want it, the Tk change was made in [commit 591f68c](https://github.com/tcltk/tk/commit/591f68cb382525b72664c6fecaab87742b6cc87a) and means that the arguments listed above are rounded relative to the value of `from`. However, when rounding the `from` argument ([line 623](https://github.com/tcltk/tk/blob/591f68cb382525b72664c6fecaab87742b6cc87a/generic/tkScale.cGH-L623)), it is rounded relative to itself (i.e. rounding `0`) and therefore the assigned value for `from` is always what is given (no matter what values of `from` and `resolution`).
Automerge-Triggered-By: @pablogsal
(cherry picked from commit aecf036738a404371303e770f4ce4fd9f7d43de7)
Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_widgets.py | 3 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2020-08-03-13-44-37.bpo-41306.VDoWXI.rst | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py index 3fb641108c..5cfab68320 100644 --- a/Lib/tkinter/test/test_tkinter/test_widgets.py +++ b/Lib/tkinter/test/test_tkinter/test_widgets.py @@ -864,7 +864,8 @@ class ScaleTest(AbstractWidgetTest, unittest.TestCase): def test_from(self): widget = self.create() - self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round) + conv = False if get_tk_patchlevel() >= (8, 6, 10) else float_round + self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=conv) def test_label(self): widget = self.create() diff --git a/Misc/NEWS.d/next/Tests/2020-08-03-13-44-37.bpo-41306.VDoWXI.rst b/Misc/NEWS.d/next/Tests/2020-08-03-13-44-37.bpo-41306.VDoWXI.rst new file mode 100644 index 0000000000..5e9ba2d8a2 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-08-03-13-44-37.bpo-41306.VDoWXI.rst @@ -0,0 +1 @@ +Fixed a failure in ``test_tk.test_widgets.ScaleTest`` happening when executing the test with Tk 8.6.10. |