[Python-checkins] cpython (2.7): Issue #6157: Fixed Tkinter.Text.debug(). Original patch by Guilherme Polo.
serhiy.storchaka
python-checkins at python.org
Sun Nov 3 13:35:15 CET 2013
http://hg.python.org/cpython/rev/b3178d03871b
changeset: 86875:b3178d03871b
branch: 2.7
parent: 86872:91453ba40b30
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Nov 03 14:28:29 2013 +0200
summary:
Issue #6157: Fixed Tkinter.Text.debug(). Original patch by Guilherme Polo.
files:
Lib/lib-tk/Tkinter.py | 5 ++-
Lib/lib-tk/test/test_tkinter/test_text.py | 11 ++++++++
Lib/lib-tk/test/test_tkinter/test_widgets.py | 13 ++++++++++
Misc/NEWS | 2 +
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -2908,8 +2908,9 @@
def debug(self, boolean=None):
"""Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN."""
- return self.tk.getboolean(self.tk.call(
- self._w, 'debug', boolean))
+ if boolean is None:
+ return self.tk.call(self._w, 'debug')
+ self.tk.call(self._w, 'debug', boolean)
def delete(self, index1, index2=None):
"""Delete the characters between INDEX1 and INDEX2 (not included)."""
self.tk.call(self._w, 'delete', index1, index2)
diff --git a/Lib/lib-tk/test/test_tkinter/test_text.py b/Lib/lib-tk/test/test_tkinter/test_text.py
--- a/Lib/lib-tk/test/test_tkinter/test_text.py
+++ b/Lib/lib-tk/test/test_tkinter/test_text.py
@@ -14,6 +14,17 @@
def tearDown(self):
self.text.destroy()
+ def test_debug(self):
+ text = self.text
+ olddebug = text.debug()
+ try:
+ text.debug(0)
+ self.assertEqual(text.debug(), 0)
+ text.debug(1)
+ self.assertEqual(text.debug(), 1)
+ finally:
+ text.debug(olddebug)
+ self.assertEqual(text.debug(), olddebug)
def test_search(self):
text = self.text
diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py
--- a/Lib/lib-tk/test/test_tkinter/test_widgets.py
+++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py
@@ -607,6 +607,19 @@
else:
self.checkEnumParam(widget, 'wrap', 'char', 'none', 'word')
+ def test_bbox(self):
+ widget = self.create()
+ bbox = widget.bbox('1.1')
+ self.assertEqual(len(bbox), 4)
+ for item in bbox:
+ self.assertIsInstance(item, int)
+
+ self.assertIsNone(widget.bbox('end'))
+ self.assertRaises(Tkinter.TclError, widget.bbox, 'noindex')
+ self.assertRaises(Tkinter.TclError, widget.bbox, None)
+ self.assertRaises(Tkinter.TclError, widget.bbox)
+ self.assertRaises(Tkinter.TclError, widget.bbox, '1.1', 'end')
+
@add_standard_options(PixelSizeTests, StandardOptionsTests)
class CanvasTest(AbstractWidgetTest, unittest.TestCase):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@
Library
-------
+- Issue #6157: Fixed Tkinter.Text.debug(). Original patch by Guilherme Polo.
+
- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
integers instead of a string. Based on patch by Guilherme Polo.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list