]> granicus.if.org Git - python/commitdiff
[3.5] bpo-30855: Trying to fix test_use on Windows. (#2585)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 5 Jul 2017 13:58:24 +0000 (15:58 +0200)
committerGitHub <noreply@github.com>
Wed, 5 Jul 2017 13:58:24 +0000 (15:58 +0200)
* 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)

Lib/tkinter/__init__.py
Lib/tkinter/test/test_tkinter/test_widgets.py

index 1a3bf889677807a0334a2525912520723251c78f..5eeefbbec88f889f746eb7b8026cd2a2b1b538ae 100644 (file)
@@ -854,8 +854,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)
index c924d559372ae0b588cef067c8f53a7e7aac4217..81b52eafea9a83a7ec6e221c9266d4e688aec725 100644 (file)
@@ -91,9 +91,10 @@ class ToplevelTest(AbstractToplevelTest, unittest.TestCase):
         widget = self.create()
         self.assertEqual(widget['use'], '')
         parent = self.create(container=True)
-        wid = parent.winfo_id()
-        widget2 = self.create(use=wid)
-        self.assertEqual(int(widget2['use']), wid)
+        wid = hex(parent.winfo_id())
+        with self.subTest(wid=wid):
+            widget2 = self.create(use=wid)
+            self.assertEqual(widget2['use'], wid)
 
 
 @add_standard_options(StandardOptionsTests)