diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-07-06 08:22:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-06 08:22:50 (GMT) |
commit | f6d6480b93eca6f353784579108957108750c004 (patch) | |
tree | af70058ba9f27f4557c94d105ca5e18035a17237 | |
parent | af6c5474cc133665d719f25281b10ecf0b303545 (diff) | |
download | cpython-f6d6480b93eca6f353784579108957108750c004.zip cpython-f6d6480b93eca6f353784579108957108750c004.tar.gz cpython-f6d6480b93eca6f353784579108957108750c004.tar.bz2 |
[2.7] bpo-30855: Trying to fix test_use on Windows. (#2586)
* bpo-30855: Trying to fix test_use on Windows.
Avoid possible weird behavior of WideInt convertion.
"winfo id" always returns string hexadecimal representation.
(cherry picked from commit b9d672491d5082c541bf267eb7bb99fdc6529324)
* bpo-30855: Trying to fix test_use on Windows.
(cherry picked from commit 29a2f7c6b38e5a6ed891aa72af38974a1ff2d372)
(subTest() removed since it was introduced in Python 3)
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 3 | ||||
-rw-r--r-- | Lib/lib-tk/test/test_tkinter/test_widgets.py | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 874e0ef..6198c4c 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -844,8 +844,7 @@ class Misc: self.tk.call('winfo', 'height', self._w)) def winfo_id(self): """Return identifier ID for this widget.""" - return self.tk.getint( - self.tk.call('winfo', 'id', self._w)) + return int(self.tk.call('winfo', 'id', self._w), 0) def winfo_interps(self, displayof=0): """Return the name of all Tcl interpreters for this display.""" args = ('winfo', 'interps') + self._displayof(displayof) diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py index 4da3096..1c4c4f3 100644 --- a/Lib/lib-tk/test/test_tkinter/test_widgets.py +++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py @@ -88,9 +88,9 @@ class ToplevelTest(AbstractToplevelTest, unittest.TestCase): widget = self.create() self.assertEqual(widget['use'], '') parent = self.create(container=True) - wid = parent.winfo_id() + wid = hex(parent.winfo_id()) widget2 = self.create(use=wid) - self.assertEqual(int(widget2['use']), wid) + self.assertEqual(widget2['use'], wid) @add_standard_options(StandardOptionsTests) |